[英]jquery error on appending html content to div tag
Here is the code I am having: 这是我的代码:
<div id="removequestions"></div>
var html += '<input type=radio name=questions />';
$.('#removequestions').append(html);
The javascript error I am getting on executng the above code is: 我在执行上面的代码时遇到的JavaScript错误是:
XML filter is applied to non-XML value (function (a, b) {return new c.fn.init(a, b);})
Any idea why this error occurs. 任何想法为什么会发生此错误。 I want to add radio button dynamically. 我想动态添加单选按钮。
Represent this way:- 用这种方式表示:
var html = "";
html += '<input type=radio name=questions />';
$('#removequestions').append(html);
Another Best way of Representation:- 另一种最佳表示方式:-
var ques = $('#removequestions');
$('<input>').attr({
'type': 'radio',
'name': 'questions'
}).appendTo(ques);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.