I'm trying get the value from text box using ID but I'm getting boolean value
<input type="text" tabindex="4" class="form-control input-sm" required onkeypress="return onlycode(event,this);" maxlength="40" id="MaterialCode" name="MaterialCode" placeholder="Material Code" autocomplete="off">
var matcode = $("#MaterialCode").val();
How to get the actual value and what's wrong my html code?
!!shortcut to convert a value to a boolean:var matcode = !!$("#MaterialCode").val();. If that doesn't work for you then please provide more detail in the question