0

这是我的代码:

<div id="removequestions"></div>

var html += '<input type=radio name=questions />';
$.('#removequestions').append(html);

我在执行上述代码时遇到的 javascript 错误是:

XML filter is applied to non-XML value (function (a, b) {return new c.fn.init(a, b);})

知道为什么会发生此错误。我想动态添加单选按钮。

4

1 回答 1

1

以这种方式表示:-

var html = "";

html += '<input type=radio name=questions />';
$('#removequestions').append(html);​

编辑:

另一种最佳表示方式:-

var ques = $('#removequestions');
$('<input>').attr({
    'type': 'radio',
    'name': 'questions'
}).appendTo(ques);

现场演示

于 2012-06-17T10:06:26.790 回答