将文本追加到单选输入的jQuery方式

Hel*_*rld 1 jquery

如何在输入广播后面附加文字。

这不会工作

$inp =  $('<input>',
          { 'type': 'radio',
            'id': 'test1',
            'name': 'test' })
         .append('hello radio box <br />');
Run Code Online (Sandbox Code Playgroud)

ahr*_*ren 5

输入元素不能有孩子,所以你不能.append()...尝试.after()

$inp =  $('<input>',
          { 'type': 'radio',
            'id': 'test1',
            'name': 'test' })
            .appendTo('body')
            .after('hello radio box <br />');
Run Code Online (Sandbox Code Playgroud)

如前所述dystroy,您不能.after()在元素位于DOM中.appendTo()之前使用它,因此需要在此之前使用。

像这样:http : //jsfiddle.net/dWLtm/