Get selected value using class :-
Get selected value using Id :-
Get text of selected value :-
Get value of nth option :-
Get index of selected option :-
Set value using class :-
Set value using Id :-
Set value using text :-
Set value using index :-
Add options in select drop down :-
Clear all options of select drop down list :-
Make drop down list disabled :-
$(".drop_down_class").val();
Get selected value using Id :-
$("#drop_down_id").val();
Get text of selected value :-
$("#drop_down_id").text();
Get value of nth option :-
$("#drop_down_id option:nth-child(1)")
Get index of selected option :-
$("#drop_down_id option:selected").index()
Set value using class :-
$('.drop_down_class').val('value');
Set value using Id :-
$('#drop_down_id').val('value');
Set value using text :-
var text = 'some_text'; $("#drop_down_id option").filter(function() { return this.text == text }).attr('selected', true);
Set value using index :-
$("#drop_down_id").attr("selectedIndex", 3);
Add options in select drop down :-
$("#drop_down_id").append( $('').val("5").html("BUG")
Clear all options of select drop down list :-
$("#drop_down_id").empty();
Make drop down list disabled :-
$("#drop_down_id").attr("disabled", true);
No comments:
Post a Comment