1

UPDATE2 : The 'jquery-1.4.4-vsdoc.js' file was an issue for some reason actually...is that file only for intellisense ? ...i commented the include out for that and it works fine now..

UPDATE: OK so it worked when I used the original js file- http://code.jquery.com/jquery-1.4.4.js

I have a dropdown: <%= Html.DropDownList("dropdownid", new SelectList(Model.WeightToLoseList, "Value", "Text")) %>

in my jQuery, I assign change event like this:

$('#dropdownid').change(function() {......});

But this event only is firing when i select anything and then click anywhere outside on the page..but I want it to work instantly and show me once I select items from the dropdownlist and not after i click outside...this behaviour is reproduced only on chrome and firefox. But it works fine on IE8. Any ideas ?

Vishal
  • 12,133
  • 17
  • 82
  • 128
  • I'm *pretty sure* `change()` will not fire until the user has committed to their selection by releasing the mouse. – Nathan Taylor Jan 28 '11 at 23:11
  • yea..that is how i want it to work but currently it only works if after releasing mouse i click anywhere else..But it works fine in IE 8..has anyone been able to reproduce the issue ? – Vishal Jan 28 '11 at 23:12

1 Answers1

1

Duplicate of Fire event each time a DropDownList item is selected with jQuery

Vincent Ramdhanie's answer was:

$(document).ready(function(){
 var clicknum = 0;
 $("#dropdownid").click(function(){
        clicknum++;
        if(clicknum == 2){
            alert($(this).val());
                clicknum = 0;
        }
 });
});
Community
  • 1
  • 1
ajma
  • 12,106
  • 12
  • 71
  • 90
  • This does not work..as i want it to fire when I select an item from dropdownlist..but it fires with this only when i click on the dropdownlist again.. – Vishal Jan 28 '11 at 23:22