Arun
Arun

Reputation: 21

how to insert textarea content inside <td> using dropdown in jquery

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

Answers (2)

Arun
Arun

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

Robin Maben
Robin Maben

Reputation: 23054

 $(".select-head").on('change',function () { 
     var selText = $(this).find('option:selected').text(); //.val() for value
     $('.textarea').val(selText);           
 });

Upvotes: 1

Related Questions