How to use HTML After Method in JQuery
This article describe about HTML After Method in JQuery.
HTML after() method in jQuery
The after() method is create to add an element in the selected element or a selected position.
Syntax
$(selector).after(content)
|
Example
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$(document).ready(function ()
{
$("button").click(function ()
{
$("p").after("<p>Hello world!</p>");
});
});
</script>
</head>
<body>
<p>This is a JQuery.</p>
<button>Insert content after click this button</button>
</body>
</html>
|
Output1
Output2
Using a Function
We use a function to insert specified content after selected elements.
Syntax
$(selector).after(function(index))
|
You may also want to read these related articles here
Ask Your Question
Got a programming related question? You may want to post your question here
Programming Answers here