You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I like the alternative method brought up by Jake, as it seems more clean. The way that jQuery works does make sense; however, the documentation is misleading. It doesn't state that the use of an Array is required, rather it states that you can use Arrays. I would add a note related to Jakes alternate method for checkboxes, as a better way of working with checkboxes.
Take it easy,
Will
The text was updated successfully, but these errors were encountered:
val() allows you to pass an array of element values. This is useful when working on a jQuery object containing elements like <input type="checkbox">, <input type="radio">, and <option>s inside of a <select>. In this case, the inputs and the options having a value that matches one of the elements of the array will be checked or selected while those having a value that doesn't match one of the elements of the array will be unchecked or unselected, depending on the type. In the case of <input type="radio">s that are part of a radio group and <select>s, any previously selected element will be deselected.
Is this description good enough for you or would you expect something different?
I created the following issue on the jQuery forums:
http://forum.jquery.com/topic/val-value-does-not-work-on-checkboxes-if-value-is-not-an-array
I like the alternative method brought up by Jake, as it seems more clean. The way that jQuery works does make sense; however, the documentation is misleading. It doesn't state that the use of an Array is required, rather it states that you can use Arrays. I would add a note related to Jakes alternate method for checkboxes, as a better way of working with checkboxes.
Take it easy,
Will
The text was updated successfully, but these errors were encountered: