I’ll share my few knowlege about jQuery. I’m not an expert on jQuery, I’m still learning how to use jQuery.
Ok let’s say you have a simple webpage, without animation, without nothing. Only the (x)html and the css stuff.
First you have to add in your html file (between <head> and </head>) the following line
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>
Ok, this is how we get the latest version of the jQuery library.Now… let’s see. You want to show a message when somebody click on a button or a link. Let’s say you have a page that is under construction and you don’t want the visitor to get there before it’s ready.Also you don’t want him to reload the page for nothing to see. What you have to do: add an id for the link or button and a div that it will hidden until the visitor clicks the link.
<a href="#" id="underConstruction">Services</a>
<div class="showMessage">Sorry, but this page is under construction</div>
Now…let’s bring jQuery in our code. Add the following lines after the body:
<script type="text/javascript">
$(document).ready(function() {
$(".showMessage").hide(); //here we will hide our message
$("#underConstruction").click(function() {
$(".showMessage").css("color","red"); //we made the message text red
$(".showMessage").show(); //here we will show the message after the visitor clicks on the link
});
});
</script>
I know, it’s looks like a piece of nothing for the guys who know jQuery but I know that on the internet are guys who are looking for this simple code. Ok, if you don’t understand my version, you can also check the documentation from jquery.com where you have more details. I hope it will help somebody.