jquery是一个快速、简洁的javascript框架,是继prototype之后又一个优秀的javascript代码库。jquery设计的宗旨是“write less,do more”,即倡导写更少的代码,做更多的事情。下面我将带大家了解一下jquery的after方法怎么用?
after() 方法在被选元素后插入指定的内容。如需在被选元素前插入内容,请使用before()方法。
语法
$(selector).after(content,function(index))
参数 | 描述 |
content | 必需。规定要插入的内容(可包含 HTML 标签)。 |
function(index) | 规定返回待插入内容的函数。index - 返回集合中元素的 index 位置。 |
举个栗子:
$("button").click(function(){ $("p").after("<p>Hello world!</p>"); });
以上就是jquery的after方法怎么用的详细内容,更多请关注php中文网其它相关文章!
Copyright 2014-2024 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号