<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Frank Perez</title>
	<atom:link href="http://www.frankperez.net/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.frankperez.net</link>
	<description>Website Developer, Programmer</description>
	<lastBuildDate>Fri, 03 Feb 2012 03:04:26 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Adding / Removing Classes and Attributes Using jQuery</title>
		<link>http://www.frankperez.net/jquery-programming/adding-removing-classes-and-attributes-jquery/</link>
		<comments>http://www.frankperez.net/jquery-programming/adding-removing-classes-and-attributes-jquery/#comments</comments>
		<pubDate>Wed, 07 Jul 2010 03:21:42 +0000</pubDate>
		<dc:creator>frankperez</dc:creator>
				<category><![CDATA[jQuery Programming]]></category>

		<guid isPermaLink="false">http://www.frankperez.net/?p=488</guid>
		<description><![CDATA[Adding and Removing attributes on elements is simple. With jQuery you can easily add or remove classes, add or remove attributes, as well as many more effects. First, as with any jQuery script, you will need to write the document &#8230; <a href="http://www.frankperez.net/jquery-programming/adding-removing-classes-and-attributes-jquery/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Adding and Removing attributes on elements is simple. With jQuery you can easily add or remove classes, add or remove attributes, as well as many more effects. First, as with any jQuery script, you will need to write the document ready function to start using your jQuery functions.</p>
<p class="code">$(function() {<br />
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // code goes here<br />
  });</p>
<p>Lets say we had some html elements as follows:</p>
<p class="code">&lt;p&gt;This is a paragraph.&lt;/p&gt;<br />
  &lt;p&gt;This is a paragraph.&lt;/p&gt;<br />
  &lt;p&gt;This is a paragraph.&lt;/p&gt;<br />
  &lt;p&gt;This is a paragraph.&lt;/p&gt;</p>
<p>If we wanted to add a class to every other p tag we could simply use the selectors while also applying some additional methods. For instance:</p>
<p class="code">$(&lsquo;p:even&rsquo;).addClass(&lsquo;evenps&rsquo;);&nbsp; // adds the class evenps to every other even p element.<br />
  $(&lsquo;p:odd).addClass(&lsquo;oddps&rsquo;);&nbsp; // adds the class oddps to every other odd p element.</p>
<p>The same would apply if we wanted to remove a class from the p tags.</p>
<p class="code">$(&lsquo;p:even&rsquo;).removeClass(&lsquo;evenps&rsquo;);&nbsp; // removes the class evenps to every other even p element.<br />
  $(&lsquo;p:odd).removeClass(&lsquo;oddps&rsquo;);&nbsp; // removes the class oddps to every other odd p element.</p>
<p>Lets say we wanted to add specific attributes without using css classes. We could use the attr() method.</p>
<p class="code">$(&lsquo;p:even&rsquo;).attr(&lsquo;color&rsquo;, &lsquo;white&rsquo;);&nbsp; // this would set the color for the even p&rsquo;s to white.</p>
<p>You could set any style using the attr method. Not only can you set attributes using this method. You can also get the value of existing attributes.</p>
<p class="code">$(&lsquo;p:even&rsquo;).attr(&lsquo;color&rsquo;);&nbsp; // this would return the value of the attribute color.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.frankperez.net/jquery-programming/adding-removing-classes-and-attributes-jquery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Selecting Different Page Elements Using jQuery</title>
		<link>http://www.frankperez.net/jquery-programming/selecting-different-page-elements-using-jquery/</link>
		<comments>http://www.frankperez.net/jquery-programming/selecting-different-page-elements-using-jquery/#comments</comments>
		<pubDate>Wed, 07 Jul 2010 02:34:30 +0000</pubDate>
		<dc:creator>frankperez</dc:creator>
				<category><![CDATA[jQuery Programming]]></category>

		<guid isPermaLink="false">http://www.frankperez.net/?p=484</guid>
		<description><![CDATA[jQuery makes it easy to reference any element on the page. If we wanted to select all the paragraphs on a page or all the inputs fields on a page the code would be all the same using jQuery. First &#8230; <a href="http://www.frankperez.net/jquery-programming/selecting-different-page-elements-using-jquery/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>jQuery makes it easy to reference any element on the page. If we wanted to select all the paragraphs on a page or all the inputs fields on a page the code would be all the same using jQuery. First off you need to remember for all jQuery code, you will be processing it between the&nbsp; document ready function.</p>
<p class="code">$(function() {<br />
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // code goes here<br />
  });</p>
<p>Lets say we wanted to select all the paragraph elements on a page. You would simply type.</p>
<p class="code">$(&lsquo;p&rsquo;);</p>
<p>The same would apply if we wanted to select all the divs on a page, or all the td&rsquo;s on a page, and even all the inputs on a page. Any element you want to select on your currently loaded page would be selected using the $(); </p>
<p class="code">$(&lsquo;p&rsquo;);&nbsp; // selects all p tags<br />
$(&lsquo;div&rsquo;);&nbsp; // selects all div tags<br />
$(&lsquo;input&rsquo;);&nbsp; // selects all input tags<br />
$(&lsquo;td&rsquo;);&nbsp; // selects all table cells</p>
<p>Lets say you only wanted to select every other paragraph tag. If you wanted to select them starting with even or odd you could do so as follows.</p>
<p class="code">$(&lsquo;p:even&rsquo;);&nbsp; // selects the even p&rsquo;s<br />
$(&lsquo;p:odd&rsquo;);&nbsp; // selects the odd p&rsquo;s</p>
<p>You could even select elements based off of id&rsquo;s, attributes, or even classes. For instance.</p>
<p class="code">$(&lsquo;p#tagid&rsquo;); // selects all p tags that contain the id of tagid<br />
$(&lsquo;p.tagclass&rsquo;);&nbsp; // selects all p tags that contain the class of tagclass<br />
$(&lsquo;input[type=text]&rsquo;);&nbsp; // selects all inputs that have the type=text</p>
<p>If you wanted to select the last or first element from a group of elements you could simply just write.</p>
<p class="code">$(&lsquo;p:first&rsquo;);&nbsp; // selects the first p<br />
$(&lsquo;p:last&rsquo;);&nbsp; // selects the last p</p>
]]></content:encoded>
			<wfw:commentRss>http://www.frankperez.net/jquery-programming/selecting-different-page-elements-using-jquery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using jQuery In Your Website</title>
		<link>http://www.frankperez.net/jquery-programming/using-jquery-in-your-website/</link>
		<comments>http://www.frankperez.net/jquery-programming/using-jquery-in-your-website/#comments</comments>
		<pubDate>Wed, 07 Jul 2010 01:57:00 +0000</pubDate>
		<dc:creator>frankperez</dc:creator>
				<category><![CDATA[jQuery Programming]]></category>

		<guid isPermaLink="false">http://www.frankperez.net/?p=474</guid>
		<description><![CDATA[For jQuery to work the elements on the page must be ready for it to be manipulated and used.&#160; Only once the DOM is loaded is when jQuery can then take effect. In order to start using jQuery we must &#8230; <a href="http://www.frankperez.net/jquery-programming/using-jquery-in-your-website/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>For jQuery to work the elements on the page must be ready for it to be manipulated and used.&nbsp; Only once the DOM is loaded is when jQuery can then take effect. In order to start using jQuery we must include two things. One is the latest jQuery file which can be downloaded from the jQuery.com website, or also included directly from the Google code repository. The second thing you need to do is include a standard function that will prepare the browser for our jQuery commands.</p>
<p>The code is</p>
<p class="code">$(document).ready(function() {<br />
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; alert(&lsquo;You have successfully loaded jQuery&rsquo;);<br />
  });</p>
<p>The code above is informing the browser that when the document is ready to run whatever is in between the curly brackets. In this case we used</p>
<p>alert(&lsquo;You have successfully loaded jQuery&rsquo;);</p>
<p>which is a regular JavaScript function that issues a message for the user to see.</p>
<p>There is another way to start jQuery. The shorthand version that is as follows</p>
<p class="code">$(function() {<br />
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; alert(&lsquo;You have successfully loaded jQuery&rsquo;);<br />
  });</p>
<p>The above code will handle exactly the same as the code described previously. It is really up to you to decide which way you prefer. Either way is perfectly acceptable.</p>
<p>Remember that all your code from now on will go within these functions. Without these functions your code will not run.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.frankperez.net/jquery-programming/using-jquery-in-your-website/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

