Reverse the html p tags with jQUERY

Post on May 30th, 2010 @ 8:48 AM by |Posted in : javascript code and samples | Tagged in : , , , | No Comment |Send Email

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!


continue on : How to call a javascript function when someone is clicking on a button of your website

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 program

This 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 javascript

Tutorial showing you how to use ‘this’ in javascript

Read More

How to create a website redirect link with javascript

Sample javascript code for creating a redirect link for your website.

Read More

How to access the name property of a javascript function

Example showing you how to output the name of a function in javascript

Read More

Changing javascript array element

Example 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 statement

javascript for statement in action with code and sample provided.

Read More

javascript for in

javascript 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 program

Example showing you how to create a new instance of the string object with javascript – code provided!

Read More

Javascript replace method review

Various examples with sample codes showing you the Javascript replace method in action.

Read More

Javascript prototype in action

In 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 Javascript

This article will show you how to change the string to upper case with javascript,

Read More


Leave a Reply

Your email address will not be published. Required fields are marked *

*


*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>