In this article of Jquery we will learn about Add Element so Let's start.
@{
ViewBag.Title = "Index";
}
<h2>Add</h2>
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="~/js/Add.js" type="text/javascript"></script>
</head>
<body>
<button id="append">Enter</button>
<img src="~/img/w3jquery.gif" id="img" width="100" height="150"/>
<button id="after">Insert after Image text</button>
<script>
$(document).ready(function () {
$("#append").click(function () {
var text = "<b>Text</b>";
$("body").append(text)
});
$("#after").click(function () {
var text = "<b>Text</b>";
$("img").after(text);
});
});
</script>
</body>
</html>
Comments
Post a Comment