当前位置: 动力学知识库 > 问答 > 编程问答 >

php - jQuery insertAfter doesn't work in some situations

问题描述:

I want to add a hidden input after some element.

I am using this code:

$("<input 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");
分享给朋友:
您可能感兴趣的文章:
随机阅读: