开发者

jQuery insertAfter doesn't work in some situations

I want to add a hidden input after some element. I am using this code:

$("<in开发者_如何学运维put type="text">").insertAfter(".addProduct");

It doesn't work. But if I replace to it works.

$("<span>ddd</span>").insertAfter(".addProduct");

It works. Help me.

Thank you.


You should use single quotes:

$('<input type="text" />').insertAfter('.addProduct');


If you create this script in php, use this:

$("<input type=\"text\">").insertAfter(".addProduct");
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜