jQuery在(添加之后)旁边添加 [英] jQuery add next to (add after)

查看:66
本文介绍了jQuery在(添加之后)旁边添加的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

HTML是
<a>ref</a>

HTML is
<a>ref</a>

我需要得到
<a>ref</a>text

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

我该怎么做? $('a').append('text')只能在<a></a>中插入文本,而不能在其后插入

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

推荐答案

使用 after insertAfter :

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

这篇关于jQuery在(添加之后)旁边添加的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆