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 t开发者_运维问答hat 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 ?
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;
}
});
});
精彩评论