<?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>Xavi Esteve &#187; cheatsheet</title>
	<atom:link href="http://xaviesteve.com/tag/cheatsheet/feed/" rel="self" type="application/rss+xml" />
	<link>http://xaviesteve.com</link>
	<description>I&#039;m a front end web developer and graphic designer from Barcelona based in London. I am passionate in JavaScript, jQuery, CSS, PHP, Wordpress, usability and SEO.</description>
	<lastBuildDate>Wed, 08 Feb 2012 16:22:24 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>jQuery-JavaScript: Basic Cheat Sheet for Beginners</title>
		<link>http://xaviesteve.com/383/jquery-javascript-basic-cheat-sheet-for-beginners/</link>
		<comments>http://xaviesteve.com/383/jquery-javascript-basic-cheat-sheet-for-beginners/#comments</comments>
		<pubDate>Sun, 20 Dec 2009 08:51:34 +0000</pubDate>
		<dc:creator>Xavi</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[English]]></category>
		<category><![CDATA[Front-End]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Web design]]></category>
		<category><![CDATA[XHTML]]></category>
		<category><![CDATA[beginners]]></category>
		<category><![CDATA[cheatsheet]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://xaviesteve.com/?p=383</guid>
		<description><![CDATA[Content Check if element exists if ($('#infobox').length) { /*exists, do things here*/ } Change attribute $('#name').attr('title', 'Hello!'); Change content of a container $('#main').html('&#60;p&#62;Lorem ipsum&#60;/p&#62;'); Change page title document.title = 'Hello!'; Add content before/after $('table&#62;tbody&#62;tr:last').after('&#60;tr&#62;&#60;td&#62;This is now the last row.&#60;/td&#62;&#60;/tr&#62;'); Style Add or remove classes $('#main').addClass('red'); $('#main').removeClass('blue'); Check if element has class if ($('#main').hasClass('green')) { } [...]]]></description>
			<content:encoded><![CDATA[<h2><img class="alignright size-full wp-image-1994" src="http://xaviesteve.com/wp-content/uploads/2009/12/13.jpg" alt="" width="600" height="280" /></h2>
<h2>Content</h2>
<p><strong>Check if element exists</strong></p>
<pre>if ($('#infobox').length) { /*exists, do things here*/ }</pre>
<p><strong>Change attribute</strong></p>
<pre><code>$('#name').attr('title', 'Hello!');</code></pre>
<p><strong>Change content of a container</strong></p>
<pre><code>$('#main').html('&lt;p&gt;Lorem ipsum&lt;/p&gt;');</code></pre>
<p><strong>Change page title</strong></p>
<pre><code>document.title = 'Hello!';</code></pre>
<p><strong>Add content before/after</strong></p>
<pre><code>$('table&gt;tbody&gt;tr:last').after('&lt;tr&gt;&lt;td&gt;This is now the last row.&lt;/td&gt;&lt;/tr&gt;');
</code></pre>
<h2>Style</h2>
<p><strong>Add or remove classes</strong></p>
<pre><code>$('#main').addClass('red');
$('#main').removeClass('blue');</code></pre>
<p><strong>Check if element has class</strong></p>
<pre>if ($('#main').hasClass('green')) { }</pre>
<h2>Ajax</h2>
<p><strong>GET with parameters</strong></p>
<pre><code>$.get("page.php", { action: "edit", id: 38 },
  function(data){
   $('#infobox').html(data);
});</code></pre>
<h2>Loops</h2>
<p><strong>Do something with every matching element</strong></p>
<pre>$('table&gt;tbody&gt;tr').each(
  function (intIndex) {
    /* Modify all table rows */
});</pre>
<h2>Maths</h2>
<p><strong>Check if even or odd</strong></p>
<pre>if ($id % 2) { /*even*/ }else{ /*odd*/ }</pre>
<p><strong>Force string to integer</strong></p>
<pre>parseInt(var);</pre>
<p><strong>Filter words, numbers or symbols</strong></p>
<pre>$(this).attr('id').replace(/[^0-9]+/, '');</pre>
<p><strong>Timer</strong></p>
<pre>setInterval(timer1s, 1000);
function timer1s() { /*run this every second*/ }</pre>
]]></content:encoded>
			<wfw:commentRss>http://xaviesteve.com/383/jquery-javascript-basic-cheat-sheet-for-beginners/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

