Hi Reader's,
Welcome to FindNerd, today we are going to discuss how to use appendTo()event in Jquery.
Basically appendto() method is used for inserting specified content of HTML elements at the end of the selected elements.
So we can say that this method always insert specified content in end of element.
Syntax of append() method
$(content).appendTo(selector)
All parameter is Required
you can see below example:
<!DOCTYPE html>
<html>
<head>
<!-- here add jquery library -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
<script>
$(document).ready(function(){
//here call button
$("button").click(function(){
//insert content at the end of selected set of elements.
$("<span> !employee name! </span>").appendTo("p");
});
});
</script>
</head>
<body>
<p>Employee detail</p>
<!-- define here button -->
<button>Insert span employee name</button>
</body>
</html>
0 Comment(s)