Javascript or Jquery auto populate one input text based on another input value -
Javascript or Jquery auto populate one input text based on another input value -
i not @ js or jquery. take follow code improve explaining what. when user input 400 or more triglycerides, ldl autopopulated 'n/a'. how implement js or jqeury that? thanks
<form> <input name='triglycerides" value="" /> <input name='ldl' value="" /> </form> my actual code follows:
$('#ldl_override').keyup(function(){ var val = parseint($(this).val()); if(val > 399) $('#qin726').val('n/a'); }); elseif($ldl_override && $questionid == 728) { $question .= "<input $maxlengthstring id=\"ldl_override\" name=\"field[" . $questionid . "]\" type=\"text\" value=\"" . htmlspecialchars($answer) . "\" />\n"; }
with jquery:
<form> <input name="triglycerides" value="" onchange="javascript: if($('#triglycerides').val() > 400) $('#ldl').val('n/a'); /> <input id="ldl" name='ldl' value="" /> </form> javascript jquery jquery-selectors
Comments
Post a Comment