Skip to content

Commit 245e460

Browse files
committed
jQuery.each - Use passed val argument instead of this in example
1 parent 4829a6d commit 245e460

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

entries/jQuery.each.xml

+4-3
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,11 @@ $.each( obj, function( key, value ) {
4848
var arr = [ "one", "two", "three", "four", "five" ];
4949
var obj = { one: 1, two: 2, three: 3, four: 4, five: 5 };
5050
51-
jQuery.each( arr, function() {
52-
$( "#" + this ).text( "Mine is " + this + "." );
51+
jQuery.each( arr, function( i, val ) {
52+
$( "#" + val ).text( "Mine is " + val + "." );
53+
5354
// Will stop running after "three"
54-
return ( this !== "three" );
55+
return ( val !== "three" );
5556
});
5657
5758
jQuery.each( obj, function( i, val ) {

0 commit comments

Comments
 (0)