Reputation: 21
I am new to jquery and have a problem.... Probably you can help...
<select name="prodName[]" class="select-head" id="prodName0">
<option value="">Select Product</option>
<option value="add_prod">Add New</option>
<-- Here i have db select query --><option value=" "></option></select>
My jquery as
$(".select-head").live('change',function() {
if($(this).val() != "") {
$(this).next().val($(this).val());
}
});
Upvotes: 2
Views: 288
Reputation: 21
$(".select-head").live('change',function () {
if($(this).val() == "add_prod") {
var price=$(this).find('option:selected').attr('role');
$(this).parent().parent().find('#num').val(price);
}
}
Upvotes: 0
Reputation: 23054
$(".select-head").on('change',function () {
var selText = $(this).find('option:selected').text(); //.val() for value
$('.textarea').val(selText);
});
Upvotes: 1