开发者

how to use jquery to creat self-closing label?

开发者 https://www.devze.com 2023-02-28 17:55 出处:网络
I tried this: $(\'<input class=\"inputName\" type=\"text\" />\').appendTo($(\'body\')) but it turns out

I tried this:

$('<input class="inputName" type="text" />').appendTo($('body'))

but it turns out

&开发者_StackOverflow中文版lt;body><input class="inputName" type="text"></body>

Is there a way to creat the proper self-closing label?


What you are doing is in fact correct. Ensure your DOCTYPE is XHTML.

Edit: You don't have to worry about any of this since the code won't pass through validators anyway (validators do not execute javascript).

0

精彩评论

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

关注公众号