Reputation: 19425
I've tried different solution without much success.
I'm able to add a <li>
to my list, but the DOM does not recognize it as a list element and thus I'm not able to manipulate it with jQuery later.
This is the last code I've tried, but I get the error msg:
TypeError:
$('</li>').class
is not a function
Code:
var data = '<div> some stuff</div>';
var index = "index-" + brand_name[0].toLowerCase();
$("</li>")
.class(index)
.text(data)
.insertAfter($(".brand_list .main-"+index))
.css('display','list-element');
I've also tried with <li></li>
and <li>
but I get the same error.
Any help much appreciated.
Upvotes: 1
Views: 64
Reputation: 38860
you should be using .addClass()
instead of .class()
. More info here: http://api.jquery.com/addClass/
Upvotes: 5