Bug Tracker

Modify

Ticket #10908 (closed bug: invalid)

Opened 18 months ago

Last modified 18 months ago

makeArray it's duplicate entries!

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

Description

Hello,

 Jsfiddle Example

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

Change History

comment:1 Changed 18 months ago by sindresorhus

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 );
});

comment:3 Changed 18 months ago by sindresorhus

  • Status changed from new to closed
  • Resolution set to invalid

comment:4 Changed 18 months ago by sindresorhus

  • Priority changed from undecided to low
  • Component changed from unfiled to core

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.