Tag Archive - javascript

Creating a jQueryUI Accordian

An accordion is the ideal choice for when you have to put a lot of information on the screen, but you do not have a lot of screen real estate available for that information.

Luckily for us we can create an accordion very easily using jQueryUI.

First thing you need to do is place all of your information inside your HTML like this:


<div id="accordion">
	<a href="#">First Section Title</a>
	<div>First Section's Content would be placed inside of this div</div>

	<a href="#">Second Section Title</a>
	<div>First Section's Content would be placed inside of this div</div>

	.... Repeat this for as many sections you want ....

</div>

Now that you have your HTML structure set up, now all you have to do is use some Javascript to tell jQuery UI to turn it into a the accordion.


<script type="text/javascript">
	jQuery(document).ready(function(){
		$('.accordion .head').click(function() {
			$(this).next().toggle('slow');
			return false;
		}).next().hide();
	});
</script>

Now you have a very easy way to put a large amount of information inside of a limited space.

innerHTML in jQuery

Probably one of the more common things you use javascript for is to do simple replacement of text within a DIV. What you may not know is that you can use jQuery to make the command shorter (which makes it easier to type) and you actually can get more functionality than regular javascript.
Continue Reading…

jQuery Selector Tutorial

Today’s topic is going to be a basic look at the jQuery Selector system.  This is one of the most widely used feature of jQuery and is one of the features that will save you the most time from regular JavaScript.
Continue Reading…

The jQuery Class

Before we have any major discussion about jQuery it is important that one understand how it works. A lot of your jQuery code will use the jQuery class. You can use the jQuery class two different ways.

jQuery('#dom') – Full text way to use jQuery. You will only use this if the shorthand functionality is already being used by another library.

$('#dom') – Shorthand way to use jQuery. Does the same as above but is significantly shorter.

Very short and quick tutorial but this is one of the most important concepts that you understand in order to be successful with jQuery.