jquery/validation plugin/object literals: selecting multiple checkboxes -


OK, I tried to read it but I have been stumped. Unfortunately, this is not a case for me to understand Javascript properly.

When processing a form with the jquery validation plugin, you send the variable to the php mailer using the literal signaling:

  submitHandler: Function () { $ .post (includes "/ mail-form.php", {age: $ ("# form-age-id"). Val (), email: $ ("# form-email-id") .val ( ), Name: $ ("# -name-name-i"). Val (),  

which I think. Variable era is being assigned a value from the element when I have If there are multiple checkboxes, then I can not use it:

  $ ("input.checkboxes: check Ed '). Val ()  

As it will only select the first matching element, so I

  var allvals = []; $ (It needs to be repeated on multiple checkboxes using the same function as' input.orthodontic-medical-form '. I disease: checked'). Each (function () {allVals.push ($ (this) .val  

I do not understand how to return the value l to iteral. I have tried

  submitHandler: function () {$ .post ("/ incl Ude mail.php ", {age: $ (" # form-age-id "). Val (), Email: $ ("#Free-Email-ID"). Val (), Name: $ ("# -Form-Name-Eye"). Val (), checkbox: function () {var allvals = []; $ ('Input.orthodontic-medical-form-disease: check'). Each (function () {allVals.push ($ (this) .val ());}); A return allVals;}  

But I'm guessing that assigning the actual function to the variable, not returned value. Can somebody help me out?

  function getCheckedVals () {/ strong>) Get the array of checked values ​​ 

Var rv = $ ('input.orthodontic-medical-form-disease: checked'). Map (function () {return $ (this) .val ();}). Receive (); Return RV .; }

and call it:

  checkbox: getCheckedVals ()  

Comments