javascript returns

Posted on 2014-08-12
Last Modified: 2014-08-12
For a multiple select I have this javascript function:

I need it to return the value of the most recently (last) item clicked.
I see that is scans through the items and returns the first seleted item it finds.

Is it possible to have it return the last item clicked? not the first one it finds?

function changeFunc() {
    var select1 = document.getElementById("armadora");
for (var i = 0; i < select1.length; i++) {
        if (select1.options[i].selected)
            tmpStr = select1.options[i].value;

Open in new window

Question by:robrodp
    LVL 58

    Accepted Solution

    Well as I already told you in the previous question you can not do this in IE

    Author Closing Comment

    Gary is right. After some volume testa were made the problem arose
    LVL 58

    Expert Comment

    I was trying to get it through to you in the other question

    Author Comment

    Well... we all have our days...

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Security Threats Are You Missing?

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    In Part 1 ( we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
    This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
    In this tutorial viewers will learn how to position items using CSS's three positioning types Create a new HTML document with an internal stylesheet.: Create another div in CSS and name it Absolute : Type "position:absolute;" and "top:10px; left:50p…
    The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now