Skip to main content

Bug Tracker

Side navigation

#10908 closed bug (invalid)

Opened November 28, 2011 02:52PM UTC

Closed November 28, 2011 09:23PM UTC

Last modified November 28, 2011 09:25PM UTC

makeArray it's duplicate entries!

Reported by: jonathan.alexey16@gmail.com Owned by:
Priority: low Milestone: None
Component: core Version: 1.7.1
Keywords: Cc:
Blocked by: Blocking:
Description

Hello,

Jsfiddle Example

If you saw with atention, you will see that print twice "um" in ul list html.

Attachments (0)
Change History (3)

Changed November 28, 2011 08:42PM UTC by sindresorhus comment:1

It's not a bug, you're just using it wrong.

jQuery finds the value of the first input it encounters that is a descendant of a <li>. In this example, the <li>s are parent and child. In both <li>s the input with the value "test" is the first it finds.

<li class="parent">
	<ul>
		<li class="child">
			<input value="test">
		<li>
	</ul>
</li>

You should instead do something like this:

http://jsfiddle.net/mofle/D83Kq/2/

$('.ulList li input').each(function(i) {
   console.log( 'inputVal', $(this).val(), i );
});

Changed November 28, 2011 09:23PM UTC by sindresorhus comment:2

resolution: → invalid
status: newclosed

Changed November 28, 2011 09:25PM UTC by sindresorhus comment:3

component: unfiledcore
priority: undecidedlow