开发者

Jquery insertAfter() format?

Is there a better way of writing this?

$('<span class="a"></span>').insertAfter($('#email'));
$('<span class="a"&g开发者_运维百科t;</span>').insertAfter($('#username'));
$('<span class="a"></span>').insertAfter($('#password'));
$('<span class="a"></span>').insertAfter($('#password_confirmation'));


insertAfter can take a query string:

$("<span class=\"a\"></span>").insertAfter("#email,#username,#password,#password_confirmation")


$('#email,#username,#password,#password_confirmation')
   .insert($('span').attr('class', 'a'));
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜