Last active
October 5, 2015 21:08
-
-
Save avireni/2877304 to your computer and use it in GitHub Desktop.
HTML Manipulation with jquery
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Changing Content of HTML through jQuery | |
<html> | |
<head> | |
<script type="text/javascript" src="jquery.js"></script> | |
<script type="text/javascript"> | |
$(document).ready(function(){ | |
$("button").click(function(){ | |
$("p").html("Change the content with jQuery"); | |
}); | |
}); | |
</script> | |
</head> | |
<body> | |
<p>This is a paragraph.</p> | |
<button>Click me</button> | |
</body> | |
</html> | |
Append content to HTML through jQuery | |
<html> | |
<head> | |
<script type="text/javascript" src="jquery.js"></script> | |
<script type="text/javascript"> | |
$(document).ready(function(){ | |
$("button").click(function(){ | |
$("p").append(" <b>Content appended through jQuery</b>."); | |
}); | |
}); | |
</script> | |
</head> | |
<body> | |
<p>This is a paragraph.</p> | |
<button>Click me</button> | |
</body> | |
</html> | |
Append Content after HTML through jQuery | |
<html> | |
<head> | |
<script type="text/javascript" src="jquery.js"></script> | |
<script type="text/javascript"> | |
$(document).ready(function(){ | |
$("button").click(function(){ | |
$("p").after(" New Paragraph added after HTML"); | |
}); | |
}); | |
</script> | |
</head> | |
<body> | |
<p>This is a paragraph.</p> | |
<button>Click me</button> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment