if ($(this).text != "END") {next()};
这不起作用。如果next()
为text
,则会执行END
功能。
if (!$(this).text == "END") {next()};
这有效,但这与接受的答案here
相反那么,这样做的正确方法是什么?
答案 0 :(得分:2)
使用$(this).text()
代替$(this).text
。它将返回标记的内部文本。否则,您正在将函数与文本进行比较。
答案 1 :(得分:1)
我认为你使用它错了.. jquery函数text();
试试这个。
if ($(this).text() != "END") {next()}; //note the parentheses
答案 2 :(得分:1)
你发表的帖子here一切都很顺利。你也可以像下面那样关注它:
if ($(this).text() != "END") {next()}; // Or
if (!($(this).text() == "END")) {next()};