This article will show you how to reverse the html p tags in a page with jQUERY.
1) Like always, you insert this code <script src=”http://code.jquery.com/jquery-latest.js”></script> within the html <head> tags.
2) Then also within the html <head> tags, you insert this code which will reverseĀ the html p tags within that page.
<script type=”text/javascript”>
$(document).ready(function(){
var money=$.makeArray(document.getElementsByTagName(“p”));
money.reverse();
$(money).appendTo(document.body);
});
</script>
3) Finally within the body tags, enter this line of code
<p>Make</p>
<p>Money</p>
<p>Online</p>
//After you have loaded the page, the output will be : Online Money Make!
This post will show you how to create a button which will call the javascript function when someone clicking on it – full code provided!
Read More Return the length of a string with javascript programThis tutorial will show you how to return the length of a string with javascript program – source code provided
Read More How to use ‘this’ in javascriptTutorial showing you how to use ‘this’ in javascript
Read More How to create a website redirect link with javascriptSample javascript code for creating a redirect link for your website.
Read More How to access the name property of a javascript functionExample showing you how to output the name of a function in javascript
Read More Changing javascript array elementExample with source code showing you how to change the array elements in javascript
Read More How to use the in javascript statement?Tutorial showing in javascript statement with code fully provided
Read More javascript for statementjavascript for statement in action with code and sample provided.
Read More javascript for injavascript for in statement showing the key and value pairs of an object. javascript for in statement showing the properties of window object also with free javascript code provided.
Read More How to create a new string object instance with javascript programExample showing you how to create a new instance of the string object with javascript – code provided!
Read More Javascript replace method reviewVarious examples with sample codes showing you the Javascript replace method in action.
Read More Javascript prototype in actionIn this article you will learn how to use javascript prototype by creating a simple program which will show an alert box with ‘Hello World!’ text.
Read More Change string to upper case with JavascriptThis article will show you how to change the string to upper case with javascript,
Read More