javascript - radio button name change for validation validation -


i want change radio button name sex1, sex2 validation.but how can add value of i

for(i=1;i<=no_applicant;i++) {   var sex = document.edu.sex+i+;   (var j=0; j<sex.length; j++) {     if (sex [j].checked)       break;   }   if (j==sex.length) {     alert("sex field "+i+" applicant  cannot leave blank");     return false;   } } 

use e.g. document.edu["sex" + i].

in javascript,foo.bar convenient shorthand foo["bar"] works when key literal string matches form of identifier name. more complicated, use bracket form.


Comments

Popular posts from this blog

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

html - How to style widget with post count different than without post count -

url rewriting - How to redirect a http POST with urlrewritefilter -