forms - Illegal character when trying to escape square brackets with jquery -


Using jquery form plugin I was trying to test the value of a form element which uses square brackets is.

  var form = jqForm [0]; If (! Form.sendTo \\ [\\]. Value] {Warning ('some'); return false; }   

Despite trying to avoid the brackets, it is still giving me an error.

Invalid character

[break this error] If (! Form.sendTo \ [\]. Value] {

Is not it possible to do this?

Thank you

You place JavaScript in place of a dot bracket and dot-notation Can use a string. Then try it out:

  var form = jqForm [0]; If (! Form ["send []"]. Value) {warnings ('some'); return false; }   

Edit after comments:

Using jQuery, you can determine how many checked check boxes are using the code Such as:

  $ ('input [name =' dispatch [] "]: checked ', form).   

value form refers to a jQuery object form that has a checkbox, if it is not, you may be able to wrap it like in the above example $ (form)

Live example:

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -