javascript - How to change an attribute value in a validation form -


i have created validation form, 1 of fields have compile:

<input type="number" name="height" min="160" max="200"/> 

but, want modify minimum number if clicks on radio button.

<input type="radio" name="gender" value="male"> 

if clicks here want set minimum number of height 170

<input type="radio" name="gender" value="female"> 

if clicks here want set minimum number of height 160

can me? :)

try this:

<input id='height_input' type="number" name="height" min="160" max="200"/> <input type="radio" name="gender" value="male" onclick="setmin(170)"> <input type="radio" name="gender" value="female" onclick="setmin(160)"> 

then in javascript:

function setmin(n) {     document.getelementbyid('height_input').min = n; } 

jquery totally unnecessary. no need use huge library such simple task. remember add id='height_input' first input show above.


Comments

Popular posts from this blog

python - mat is not a numerical tuple : openCV error -

c# - MSAA finds controls UI Automation doesn't -

wordpress - .htaccess: RewriteRule: bad flag delimiters -