javascript - Simple dynamic form -
i have ai need validate input .onblur such whenever text input loses focus gets validated same js function.
my problem js function. want grab value of item loses focus.
function valid(){ if (isnan("this should value of text item??")){ } thankss..
to grab value of item blur, should add together onblur trigger dom element follows:
<input type="text" name="validate_me" onblur="valid(this);" /> that way have access dom element triggered onblur event , can access properties (such value or innerhtml in case of textarea elements.
your valid function can like:
function valid(element) { if (element.value != '' && isnan(element.value)) alert('this field not valid!'); }; javascript forms dynamic input textinput
No comments:
Post a Comment