Skip to content

Conversation

@kswedberg
Copy link
Member

Added a statement about the difference between >=3.0 and <3.0 when calling .val() on <select multiple> with no options selected.

@mgol
Copy link
Member

mgol commented Jul 14, 2016

Have you seen #939? What do you think about code example changes there?

@kswedberg
Copy link
Member Author

Oh, bummer! I didn't see that one. The code example change there looks fine to me. Maybe we could merge that one first. Then merge mine, keeping that code change but using my content change?

@mgol
Copy link
Member

mgol commented Jul 14, 2016

Sounds good. Would you do that?

Michał Gołębiowski

@kswedberg
Copy link
Member Author

sure.

@gibson042
Copy link
Member

LGTM.

entries/val.xml Outdated
<p><code>val()</code> allows you to pass an array of element values. This is useful when working on a jQuery object containing elements like <code>&lt;input type="checkbox"&gt;</code>, <code>&lt;input type="radio"&gt;</code>, and <code>&lt;option&gt;</code>s inside of a <code>&lt;select&gt;</code>. In this case, the <code>input</code>s and the <code>option</code>s having a <code>value</code> that matches one of the elements of the array will be checked or selected while those having a <code>value</code> that doesn't match one of the elements of the array will be unchecked or unselected, depending on the type. In the case of <code>&lt;input type="radio"&gt;</code>s that are part of a radio group and <code>&lt;select&gt;</code>s, any previously selected element will be deselected.</p>
<p>Setting values using this method (or using the native <code>value</code> property) does not cause the dispatch of the <code>change</code> event. For this reason, the relevant event handlers will not be executed. If you want to execute them, you should call <code>.trigger( "change" )</code> after setting the value.</p>
<p>The <code>.val()</code> method allows us to set the value by passing in a function. As of jQuery 1.4, the function is passed two arguments, the current element's index and its current value: </p>
<p>The <code>.val()</code> method allows settting the value by passing in a function. As of jQuery 1.4, the function is passed two arguments, the current element's index and its current value: </p>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"settting" should be "setting"

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch. thanks!

@kswedberg kswedberg closed this in ef2a80e Jul 17, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

6 participants