jquery script to retrieve select value on click: works in Firefox, does not in Internet Explorer

Posted by vatshal on Stack Overflow See other posts from Stack Overflow or by vatshal
Published on 2010-06-05T12:04:21Z Indexed on 2010/06/05 12:12 UTC
Read the original article Hit count: 151

Filed under:

hi

vatshal here; I am using a jquery script in which I am getting the current value of a select box on mouse click; it works on Mozila Firefox but doesn't work in Internet Explorer

onclick in IE shows previous value from the select box id

<select>
         <option>value1</option>
         <option>value2</option>
</select>

if we are clicking on value2 then jquery gets the value of the first element, but it is working on mozila firefox only; jquery code is given below:

<script type="text/javascript" src="jquery-1.4.2.js"></script>
<script type="text/javascript">
    $(function(){
    $("#multiple").click(function(){
        var a=$("#multiple").val();
        $("#to").val(a);
    });
});
</script>

Please help me

© Stack Overflow or respective owner

Related posts about jQuery