Smile

Smile

  • 1.4k
  • 198
  • 34.3k

how to read a text box value using jquery

Mar 14 2018 6:47 AM
i am using a select control while showing all the availble items from the database,but when i want to add a new record i am converting the select in a text box.After converting the text box i am unable to read the value of it 
 
select declration 
<tr>
<td style="width: 10em; border: 0 !important;"><span style="color: red">*</span>Board ID</td>
<td class="form-group form-group-sm" style="border: 0 !important;">
<select class="form-control" id="cmbBoardID" name="cmbBoardID" style="width: 6.6em; padding-left: 1px;">
</select></td>
</tr>
 converting to text box
function Add() {
$('#cmbBoardID').replaceWith($("<input/>", { type: "text" }));
 }
 
  reading the value
 
Var Boardid = $('#cmbBoardID').val(); 
 
 
getting undefined while reading value as above.Any suggestions would be helpful .
Thanxs in advance 
 

Answers (1)