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>').classis 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.
.addClassinstead of.class....css()is not doing it. Any suggestions?$('<li/>')list-elementis not a valid display property. Uselist-item.