我有一个具有此标记的HTMl字段:
<label for="id_data_path_ip_0">
<input class="radiolist inline" id="id_data_path_ip_0" name="data_path_ip" type="radio" value="Tool"> Same as Tool</label>
有没有办法用jQuery添加这个缩写?如果我正在编写HTML,它将如下所示:
<label for="id_data_path_ip_0">
<acronym class="help" title="This requires the setup of a remote mount.">?</acronym>
<input class="radiolist inline" id="id_data_path_ip_0" name="data_path_ip" type="radio" value="Tool"> Same as Tool</label>
答案 0 :(得分:2)
如果您想在label
之后找到它,那么您需要定位label
代码的.after()
..
var abbr = '<abbr class="help" title="This requires the setup of a remote mount.">?</abbr>'
$('label[for="id_data_path_ip_0"]').after(abbr);
演示
答案 1 :(得分:0)
不确定这是否是您所追求的,但您可以使用.before()
在输入标记之前插入首字母缩略词:
$(".radiolist").before( "<acornym....." );