开发者

Problem in displaying selected value in dropdown in Mozilla iPhone client

I am开发者_如何学C trying to change value of a dropdown dynamically using JQuery.I changed the client in Mozilla to Iphone.Whatever value i am setting does not display in dropdown it stays same.

Anyone got any clue? This is the code to change the value of dropdown.

    jQuery("#billingAddressState").val('CA')


there's always the other way round, try:

jQuery('#billingAddressState option').removeAttr('selected').filter('[value="CA"]').attr('selected', 'selected');


I know it's a bit late but I got the same issue while working with firefox 3.6 select tags and this is what I did to solve it

 jQuery('#billingAddressState option[value="CA"]').prop('selected', 'selected');

according to the jquery site we are supposed To retrieve and change DOM properties such as the checked, selected, or disabled state of form elements, use the .prop() method.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜