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 functionTypeError:$(' ')。class不是函数
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.
任何帮助非常感谢。
1 个解决方案
#1
5
you should be using .addClass()
instead of .class()
. More info here: http://api.jquery.com/addClass/
你应该使用.addClass()而不是.class()。更多信息:http://api.jquery.com/addClass/
#1
5
you should be using .addClass()
instead of .class()
. More info here: http://api.jquery.com/addClass/
你应该使用.addClass()而不是.class()。更多信息:http://api.jquery.com/addClass/