sreenu sreenu - 1 year ago 103
jQuery Question

How to set value in dropdown using Jquery?

Hi I am setting a value in a drop down using jquery in the following ways.

$("#dropDownItems option[value='--Select--']").attr('selected', 'true');

$("#dropDownItems option[value='--Select--']").attr('selected', 'selected');

But none of these are working for FireFox! and is working fine for remaining browsers.

Can any one help me out?

Answer Source

This should do the trick for you.

$('#dropdownID').val("Value to be selected");
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download