开发者

Jquery insertAfter() format?

开发者 https://www.devze.com 2023-03-24 05:11 出处:网络
Is there a better way of writing this? $(\'<span class=\"a\"></span>\').insertAfter($(\'#email\'));

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

精彩评论

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

关注公众号