I just need simple method to insert fetch bootstrap drop down value with input text but showing NAN Scratching my head from a day not reaching any conclusion so if any value is selected and input text filled it should give output on same page then upon save should enter value so that it can be fetched for printing receipts. but showing NAN.Hope i get answer her as really strucked.Kindly overlook my poor English..
<div class="col-md-2">
<div class="form-group">
<label for="specs" class="control-label">Spec</label>
<select class="form-select" id="specs" name="specs">
<option selected>select</option>
<option value="kt">Kt</option>
<option value="ct">Ct</option>
<option value="oth">Other</option>
</select>
</div>
<input type="text" value="0" name="specsa" class="form-control text-left" placeholder="specification">
</div>
//Just for reference
specs = $('#specs').val();
specs = $obj.specs;
td.text(parseFloat(specs).toLocaleString('en-US'))
td.append("<input type='hidden' name='specs[]' value='" + specs + "' />") //item input
I think you've overcomplicated it. The specific reason why you're seeing NaN (i.e. "Not A Number") is because the values in your options aren't numbers, so you cannot use parseFloat() to parse them.
This code is sufficient to read the value:
specs = $('#specs').val();
td.text(specs);
td.append("<input type='hidden' name='specs[]' value='" + specs + "' />");