Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
138 views
in Technique[技术] by (71.8m points)

jQuery add next to (add after)

HTML is
<a>ref</a>

I need to get
<a>ref</a>text

How can i do this? $('a').append('text') only insert text into <a></a>, not after it

question from:https://stackoverflow.com/questions/2607592/jquery-add-next-to-add-after

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Use after or insertAfter:

$('a').after('text');
$('text').insertAfter('a');

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...