Created
July 9, 2015 17:17
-
-
Save ewilazarus/ac07a712eba9c2cc50e1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// BUG | |
var id = 1; | |
for (var i = 0; i < products.length; i++) { | |
if (contains(offsetX, offsetY, products[i], 4)) { | |
var productName = products[i].name | |
var button = $('<button></button>'). | |
prop("class", "btn btn-xs btn-danger"). | |
click(function() { | |
clean(id, productName); | |
}). | |
text("X"); | |
var span = $('<span></span>'). | |
addClass("pull-right"). | |
append(button); | |
var li = $('<li></li>'). | |
prop("id", "info" + id). | |
prop("class", "list-group-item clearfix"). | |
text(productName). | |
append(span); | |
$("#info").append(li); | |
id++; | |
} | |
} | |
// CORRECAO | |
var id = 1; | |
for (var i = 0; i < products.length; i++) { | |
if (contains(offsetX, offsetY, products[i], 4)) { | |
var productName = products[i].name | |
var button = $('<button></button>'). | |
prop("class", "btn btn-xs btn-danger"). | |
click((function(id) { | |
return function() { | |
clean(id, productName); | |
} | |
})(id)). | |
text("X"); | |
var span = $('<span></span>'). | |
addClass("pull-right"). | |
append(button); | |
var li = $('<li></li>'). | |
prop("id", "info" + id). | |
prop("class", "list-group-item clearfix"). | |
text(productName). | |
append(span); | |
$("#info").append(li); | |
id++; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment