I am trying to use jQuery .attr
function to add multiple ids to an element. However I found out that if I have multiple ids in the .attr
function the function error out.
Error Code
var some_global = 0;
$('#btnName').click(function(){
var k = $("<label>", {html: "->label"});
$('<li>', {html: "list"})
.attr("id", some_global + " error") // adding multiple id cause error
.css("display"," block")
.appendTo('ul.justList')
k.appendTo("li#"+some_global);
some_global += 1;
});
I briefly scanned the documentation and it seems like this isn't necessary a forbidden usage. Can someone point me a direction?