show text in select box in jquery -
i have select box , according selected value want show value in next selected box. code like:
$('#category').change(function(){ var cat_val = $('#category option:selected').text(); if(cat_val == 'online'){ $('#workshop-row').hide(); $('#bu_id').val(22); }else{ $('#workshop-row').show(); } });
by doing $('#bu_id').val(22);
can value. need set text not val()
$('#bu_id option:selected').text("online");
that means if select online first select box in 2nd select box, value text online selected.
please guide me. in advance.
this select option has text value cat_val
$("#bu_id option:contains(" + cat_val + ")").attr('selected', 'selected');
Comments
Post a Comment