<?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>Relax Breath of Solution.</title>
	<atom:link href="http://www.beasrilankan.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.beasrilankan.com</link>
	<description>Just I wanted.. Do you?...</description>
	<lastBuildDate>Wed, 14 Dec 2011 17:52:35 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>jQuery creating custom animations</title>
		<link>http://www.beasrilankan.com/2011/09/jquery-creating-custom-animations/</link>
		<comments>http://www.beasrilankan.com/2011/09/jquery-creating-custom-animations/#comments</comments>
		<pubDate>Thu, 29 Sep 2011 07:38:25 +0000</pubDate>
		<dc:creator>Sameera Thilakasiri</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[jQuery Examples]]></category>
		<category><![CDATA[jQuery Tutorials]]></category>
		<category><![CDATA[jQuery Animation]]></category>
		<category><![CDATA[jQuery Custom Animations]]></category>

		<guid isPermaLink="false">http://www.beasrilankan.com/?p=919</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<pre class="brush: xml; title: ; notranslate">
&lt;HTML&gt;
	&lt;HEAD&gt;
		&lt;TITLE&gt; jQuery creating custom animations &lt;/TITLE&gt;
		&lt;script type=&quot;text/javascript&quot; src=&quot;https://ajax.googleapis.com/
		ajax/libs/jquery/1.4.2/jquery.min.js&quot;&gt;&lt;/script&gt;
	&lt;/HEAD&gt;
	&lt;BODY&gt;
		&lt;div id=&quot;clickme&quot; &gt;
			&lt;font color=&quot;red&quot;&gt; Click here &lt;/font&gt;
		&lt;/div&gt;
		&lt;img id=&quot;book&quot; src=&quot;http://ampersandtr.eweb101.discountasp.net/
		img/tm/co/SK/SIGIRAYA/Places%20To%20Visit%20In%20Sri%20Lanka%201.jpg&quot;
		alt=&quot;&quot; width=&quot;200&quot; height=&quot;223&quot;
		style=&quot;position: relative; left: 10px;&quot; /&gt;
		&lt;script&gt;
			$('#clickme').click(function() {
				$(&quot;#targetDiv&quot;).hide();
				$('#book').animate({
					opacity : 0.25,
					left : '+=50',
					height : 'toggle'
				}, 5000, function() {
					// Animation complete.
					$(&quot;#targetDiv&quot;).html(&quot;&lt;h3&gt;&quot; + &quot;Click link to animate&quot; + &quot;&lt;/h3&gt;&quot;).fadeIn(&quot;slow&quot;);
				});
			});
		&lt;/script&gt;
		&lt;font color=&quot;blue&quot;&gt;
			&lt;div id=&quot;targetDiv&quot; style=&quot;display: none;&quot;&gt;&lt;/div&gt;
		&lt;/font&gt;
	&lt;/BODY&gt;
&lt;/HTML&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.beasrilankan.com/2011/09/jquery-creating-custom-animations/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery fading elements in and out</title>
		<link>http://www.beasrilankan.com/2011/09/jquery-fading-elements-in-and-out/</link>
		<comments>http://www.beasrilankan.com/2011/09/jquery-fading-elements-in-and-out/#comments</comments>
		<pubDate>Thu, 29 Sep 2011 05:51:52 +0000</pubDate>
		<dc:creator>Sameera Thilakasiri</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[jQuery Examples]]></category>
		<category><![CDATA[jQuery Fade in and out]]></category>

		<guid isPermaLink="false">http://www.beasrilankan.com/?p=917</guid>
		<description><![CDATA[Fading elements in and out]]></description>
			<content:encoded><![CDATA[<p>Fading elements in and out</p>
<pre class="brush: xml; title: ; notranslate">
&lt;html&gt;
	&lt;head&gt;
		&lt;style&gt;
			ul {
				margin-left: 20px;
				color: blue;
			}
			li {
				cursor: default;
			}
			span {
				color: red;
			}
		&lt;/style&gt;
		&lt;script src=&quot;jquery-1.4.2.js&quot;&gt;&lt;/script&gt;
	&lt;/head&gt;
	&lt;h3&gt;&lt;font color=&quot;red&quot;&gt;Hover on any element to see effect&lt;/font&gt;&lt;/h3&gt;
	&lt;body&gt;
		&lt;ul&gt;
			&lt;li&gt;Cake&lt;/li&gt;
			&lt;li&gt;Pastries&lt;/li&gt;
			&lt;li class='fade'&gt;Patties&lt;/li&gt;
			&lt;li class='fade'&gt;Noodles&lt;/li&gt;
		&lt;/ul&gt;
		&lt;script&gt;
			$(&quot;li&quot;).hover(function() {
				$(this).append($(&quot;&lt;span&gt;&lt;&lt;&lt; &lt;/span&gt;&quot;));
			}, function() {
				$(this).find(&quot;span:last&quot;).remove();
			});
			//li with fade class
			$(&quot;li.fade&quot;).hover(function() {
				$(this).fadeOut(100);
				$(this).fadeIn(500);
			});

		&lt;/script&gt;
	&lt;/body&gt;
&lt;/html&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.beasrilankan.com/2011/09/jquery-fading-elements-in-and-out/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery hiding and showing elements on the page &#8211; arguments.callee</title>
		<link>http://www.beasrilankan.com/2011/09/jquery-hiding-and-showing-elements-on-the-page-arguments-callee/</link>
		<comments>http://www.beasrilankan.com/2011/09/jquery-hiding-and-showing-elements-on-the-page-arguments-callee/#comments</comments>
		<pubDate>Thu, 29 Sep 2011 05:25:50 +0000</pubDate>
		<dc:creator>Sameera Thilakasiri</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[jQuery Examples]]></category>
		<category><![CDATA[arguments.callee]]></category>
		<category><![CDATA[jQuery Recursive]]></category>

		<guid isPermaLink="false">http://www.beasrilankan.com/?p=915</guid>
		<description><![CDATA[Incoming search terms:samples mx effects easing (1)]]></description>
			<content:encoded><![CDATA[<pre class="brush: xml; title: ; notranslate">
&lt;body&gt;
	&lt;button id=&quot;hideBtn&quot;&gt;Hide&lt;/button&gt;
        &lt;button id=&quot;showBtn&quot;&gt;Show&lt;/button&gt;
  &lt;div&gt;

    &lt;span&gt;jQuery&lt;/span&gt; &lt;span&gt;is&lt;/span&gt; &lt;span&gt;easy&lt;/span&gt;
    &lt;span&gt;to&lt;/span&gt; &lt;span&gt;use&lt;/span&gt; &lt;span&gt;and&lt;/span&gt;
    &lt;span&gt;gives&lt;/span&gt; &lt;span&gt;dynamic output..&lt;/span&gt;

  &lt;/div&gt;
&lt;script&gt;
    $(&quot;#hideBtn&quot;).click(function () {
         $(&quot;span:last-child&quot;).hide(&quot;fast&quot;, function () {
         // use callee so don't have to name the function
         /*It then hides those spans it found. The second argument to hide is a callback after the animation. That callback goes to the &quot;previous&quot; child (the 'something else' text node), hiding it and passing the &quot;called function&quot; (arguments.callee) as the callback. Which makes this a &quot;recursive&quot; function.
         */
         $(this).prev().hide(&quot;fast&quot;, arguments.callee);
      });
    });
    $(&quot;#showBtn&quot;).click(function () {
          $(&quot;span&quot;).show(2000);
    });

&lt;/script&gt;
&lt;/body&gt;
</pre>
<h4>Incoming search terms:</h4><ul><li><a href="http://www.beasrilankan.com/2011/09/jquery-hiding-and-showing-elements-on-the-page-arguments-callee/" title="samples mx effects easing">samples mx effects easing</a> (1)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.beasrilankan.com/2011/09/jquery-hiding-and-showing-elements-on-the-page-arguments-callee/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery event helpers</title>
		<link>http://www.beasrilankan.com/2011/09/jquery-event-helpers/</link>
		<comments>http://www.beasrilankan.com/2011/09/jquery-event-helpers/#comments</comments>
		<pubDate>Wed, 28 Sep 2011 13:15:38 +0000</pubDate>
		<dc:creator>Sameera Thilakasiri</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[jQuery Examples]]></category>
		<category><![CDATA[jQuery event helpers]]></category>

		<guid isPermaLink="false">http://www.beasrilankan.com/?p=913</guid>
		<description><![CDATA[.live() This method attach a handler to the event for all elements which match the current selector, now or in the future. Example : Following code binds the click event to all paragraphs. And add a paragraph to another clicked paragraph : Click me! .die( ) This method removes the handler which is previously attached [...]]]></description>
			<content:encoded><![CDATA[<p><strong>.live()</strong><br />
This method attach a handler to the event for all elements which match the current selector, now or in the future.</p>
<p>Example :<br />
Following code binds the click event to all paragraphs. And add a paragraph to another clicked paragraph :<br />
<body></p>
<p>Click me!</p>
<p><span></span><br />
<script>
$("p").live("click", function(){
$(this).after("
<p>Another paragraph!</p>
<p>");
});
</script></p>
<p><strong>.die( )</strong><br />
This method removes the handler which is previously attached using &#8216;live( )&#8217; from the elements.</p>
<p>Example :<br />
Following code binds and unbinds events to the buttons :<br />
$(&#8220;#bindbutton&#8221;).click(function () {<br />
$(&#8220;#button1&#8243;).live(&#8220;click&#8221;, aClick)<br />
.text(&#8220;Can Click!&#8221;);<br />
});<br />
$(&#8220;#unbindbutton&#8221;).click(function () {<br />
$(&#8220;#button2&#8243;).die(&#8220;click&#8221;, aClick)<br />
.text(&#8220;Does nothing&#8230;&#8221;);<br />
});</p>
<p>Here &#8216;aclick&#8217; is a user defined function which display a &#8216;div&#8217; on button click. Using &#8216;die&#8217; it detach the click event from &#8216;aClick&#8217; function.</p>
<p><strong>.one( )</strong><br />
This method attach the element with an event.  The main difference between it and &#8216;.bind()&#8217; is that it will execute only once .After this , it is unbind automatically.</p>
<p>Example :<br />
Following code will display an alert box on clicking element &#8216;foo&#8217; :<br />
$(&#8216;#foo&#8217;).one(&#8216;click&#8217;, function() {<br />
alert(&#8216;This will be displayed only once.&#8217;);<br />
});</p>
<p><strong>jQuery.proxy( )</strong><br />
This method takes a function and returns a new one that will always have a particular scope.</p>
<p>Example :<br />
It will enforce the function :<br />
var obj = {<br />
 name: &#8220;John&#8221;,<br />
 test: function() {<br />
 alert( this.name );<br />
 $(&#8220;#test&#8221;).unbind(&#8220;click&#8221;, obj.test);<br />
 }<br />
};</p>
<p>$(&#8220;#test&#8221;).click( jQuery.proxy( obj, &#8220;test&#8221; )</p>
<p><strong>.trigger( )</strong><br />
This method executes the event which is attached with the matched elements.</p>
<p>Example :<br />
Following code triggered the click event on &#8216;foo&#8217; element manually .<br />
$(&#8216;#foo&#8217;).bind(&#8216;click&#8217;, function() {<br />
 alert($(this).text());<br />
 });<br />
$(&#8216;#foo&#8217;).trigger(&#8216;click&#8217;);</body></p>
]]></content:encoded>
			<wfw:commentRss>http://www.beasrilankan.com/2011/09/jquery-event-helpers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery working with CSS(CSS Manipulation)</title>
		<link>http://www.beasrilankan.com/2011/09/jquery-working-with-csscss-manipulation/</link>
		<comments>http://www.beasrilankan.com/2011/09/jquery-working-with-csscss-manipulation/#comments</comments>
		<pubDate>Wed, 28 Sep 2011 12:28:24 +0000</pubDate>
		<dc:creator>Sameera Thilakasiri</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[jQuery Examples]]></category>
		<category><![CDATA[jQuery CSS Manipulation]]></category>
		<category><![CDATA[jQuery Tips and Tricks]]></category>

		<guid isPermaLink="false">http://www.beasrilankan.com/?p=902</guid>
		<description><![CDATA[.css( ) This method get the CSS style property of the first matched element.. Example : Above code display the color code of the clicked &#8216;div&#8217; . .height( ) This method get the height of the first matched element. Example : $(&#8220;p&#8221;).height()); // returns height of paragraph. $(window).height(); // returns height of browser viewport $(document).height(); [...]]]></description>
			<content:encoded><![CDATA[<p><strong>.css( )</strong><br />
This method get the CSS style property of the first matched element..</p>
<p>Example :<br />
<script>
$("div").click(function () {
  var color = $(this).css("background-color");
  $("#result").html("That div is <span style='color:" +
   color + ";'>" + color + "</span>.");
});
</script><br />
Above code display the color code of the clicked &#8216;div&#8217; .</p>
<p><strong>.height( )</strong><br />
This method get the height of the first matched element.</p>
<p>Example :<br />
$(&#8220;p&#8221;).height());   // returns height of paragraph.<br />
$(window).height();   // returns height of browser viewport<br />
$(document).height();  // returns height of HTML document </p>
<p><strong>.innerHeight( )</strong><br />
This method return the height for the first element including padding but not border. This method is not applicable to window and document objects; for these, use .height() instead.</p>
<p>Example :<br />
Following code get the innerHeight of a paragraph :<br />
<body></p>
<p>Hello</p>
</p>
<p><script>
var p = $("p:first");
$("p:last").text( "innerHeight:" + p.innerHeight() );
</script><br />
</body></p>
<p><strong>.innerWidth( )</strong><br />
This method return the width for the first element including padding but not border. This method is not applicable to window and document objects; for these, use .height() instead.</p>
<p>Example :<br />
Following code will get the innerWidth of a paragraph :<br />
<body></p>
<p>Hello</p>
</p>
<p><script>
var p = $("p:first");
$("p:last").text( "innerWidth:" + p.innerWidth() );
</script><br />
</body></p>
<p><strong>.offset( )</strong><br />
This method get the current coordinate of the matched element, relative to the document.</p>
<p>Example :<br />
This method returns the offset of the second paragraph<br />
<body></p>
<p>Hello</p>
<p>2nd Paragraph</p>
<p><script>var p = $("p:last");
var offset = p.offset();
p.html( "left: " + offset.left + ", top: " + offset.top );
</script><br />
</body></p>
<p><strong>.outerHeight( )</strong><br />
This method get the outer Height from the first matched element, including padding and border.This method is not applicable to window and document objects; for these, use .height() instead.<br />
Example :</p>
<p>The following code get the outer Height of a paragraph :<br />
<body></p>
<p>Hello</p>
</p>
<p><script>var p = $("p:first");
$("p:last").text( "outerHeight:" + p.outerHeight() + " , outerHeight(true):" + p.outerHeight(true) );
</script><br />
</body></p>
<p><strong>.outerWidth( )</strong><br />
This method get the outer width from the first matched element, including padding and border.This method is not applicable to window and document objects; for these, use .height() instead.</p>
<p>Example :<br />
The following code get the outer Width  of a paragraph :<br />
<body></p>
<p>Hello</p>
</p>
<p><script>var p = $("p:first");
$("p:last").text( "outerWidth:" + p.outerWidth()+ " , outerWidth(true):" + p.outerWidth(true) );
</script><br />
</body></p>
<p><strong>.position( )</strong><br />
This method get the coordinates of the first matched element , relative to the offset parent.</p>
<p>Example :<br />
Following code return the position of the second paragraph :<br />
<body></p>
<p>Hello</p>
</p>
<p><script>var p = $("p:first");
$("p:last").text( "outerWidth:" + p.outerWidth()+ " , outerWidth(true):" + p.outerWidth(true) );
</script><br />
</body></p>
<p><strong>.scrollLeft( )</strong><br />
This method get the current horizontal position of the scroll bar for  the first matched element.</p>
<p>Example :<br />
Following code get the current horizontal position of the scroll bar for  the first &#8216;p&#8217; :<br />
<body></p>
<p>Hello</p>
</p>
<p><script>var p = $("p:first");
$("p:last").text( "scrollLeft:" + p.scrollLeft() );
</script><br />
</body></p>
<p><strong>.scrollTop( )</strong><br />
This method get the current vertical position of the scroll bar for  the first matched element.</p>
<p>Example :<br />
Following code get the current vertical position of the scroll bar for  the first &#8216;p&#8217; :<br />
<body></p>
<p>Hello</p>
</p>
<p><script>
var p = $("p:first");
$("p:last").text( "scrollTop:" + p.scrollTop() );
</script><br />
</body></p>
<p><strong>.width( )</strong><br />
This method get the width of the first matched element.</p>
<p>Example :<br />
Following are some example of &#8216;width()&#8217; method :<br />
$(&#8220;p&#8221;).width());  //returns width of paragraph.<br />
$(window).width();   // returns width of browser viewport<br />
$(document).width();  // returns width of HTML document</p>
<h4>Incoming search terms:</h4><ul><li><a href="http://www.beasrilankan.com/2011/09/jquery-working-with-csscss-manipulation/" title="css with jquery examples">css with jquery examples</a> (1)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.beasrilankan.com/2011/09/jquery-working-with-csscss-manipulation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery inserting content(DOM Insertion)</title>
		<link>http://www.beasrilankan.com/2011/09/jquery-inserting-contentdom-insertion/</link>
		<comments>http://www.beasrilankan.com/2011/09/jquery-inserting-contentdom-insertion/#comments</comments>
		<pubDate>Wed, 28 Sep 2011 12:04:55 +0000</pubDate>
		<dc:creator>Sameera Thilakasiri</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[jQuery Examples]]></category>
		<category><![CDATA[jQuery DOM Insertion]]></category>

		<guid isPermaLink="false">http://www.beasrilankan.com/?p=900</guid>
		<description><![CDATA[.unwrap( ) The .unwrap() method removes the element&#8217;s parent from the matched set .It leaves the matched element at their place. Example : $(&#8220;p&#8221;).unwrap(); This script removes the parent of &#8216;p&#8217;. .wrap( wrappingElement ) This method wrap the html wrapping element around each of the matched elements. The &#8216;wrapedElement &#8216; may be div, span etc. [...]]]></description>
			<content:encoded><![CDATA[<p><strong>.unwrap( )</strong><br />
The .unwrap() method removes the element&#8217;s parent from the matched set .It leaves the matched element at their place.</p>
<p>Example :<br />
$(&#8220;p&#8221;).unwrap();<br />
This script removes the parent of &#8216;p&#8217;.</p>
<p><strong>.wrap( wrappingElement )</strong><br />
This method wrap the html wrapping element around each of the matched elements. The &#8216;wrapedElement &#8216; may be div, span etc.</p>
<p>Example :<br />
$(&#8220;p&#8221;).wrap(&#8220;
<div></div>
<p>&#8220;);<br />
It wrap a div element around each matched &#8216;p&#8217;. The structure will be wrapped around each of the elements in the set of matched elements.</p>
<p><strong>.wrapAll( wrappingElement )</strong><br />
This method wrap the html wrapping element around all the matched elements. The &#8216;wrapedElement &#8216; may be div, span etc. The structure will be wrapped around all of the elements in the set of matched elements, as a single group.</p>
<p>Example :<br />
$(&#8220;p&#8221;).wrapAll(&#8220;
<div></div>
<p>&#8220;);<br />
It wrap div around all the &#8216;p&#8217; element as a single group.</p>
<p><strong>.wrapInner( wrappingElement )</strong><br />
This method wrap inside the provided &#8216;wrappingElement&#8217;.</p>
<p>Example :<br />
$(&#8220;p&#8221;).wrapInner(&#8220;<b></b>&#8220;);<br />
It wrap <b> inside the &#8216;p&#8217; or &#8216;p&#8217; s.</p>
<p><strong>DOM Insertion, Inside</strong><br />
This method allow us to insert new content inside an existing once</p>
<p><strong>.append( content)</strong><br />
This method add new content inside the matched set of element , after the existing contents.</p>
<p>Example :<br />
$(&#8216;.inner&#8217;).append(&#8216;
<p>Test</p>
<p>&#8216;);<br />
This method insert
<p> inside the div class named &#8216;inner &#8216; after it&#8217;s existing content.</p>
<p><strong>.appendTo( target )</strong><br />
This method insert every element in the set of matched elements to the end of the target.</p>
<p>Example :<br />
$(&#8216;</p>
<p>Test</p>
<p>&#8216;).appendTo(&#8216;.inner&#8217;);<br />
This method insert
<p> inside the div class named &#8216;inner &#8216; after it&#8217;s existing content.</p>
<p><strong>.prepend( content )</strong><br />
This method add new content inside the matched set of element , before the existing contents.</p>
<p>Example :<br />
$(&#8216;.inner&#8217;).prepend(&#8216;</p>
<p>Test</p>
<p>&#8216;);<br />
It add &#8216;
<p>Test</p>
<p>&#8216; before the div named &#8216;inner&#8217;.</p>
<p><strong>.prependTo( )</strong><br />
This method insert every element in the set of matched elements to the beginning of the target.</p>
<p>Example :<br />
$(&#8216;
<p>Test</p>
<p>&#8216;).prependTo(&#8216;.inner&#8217;);<br />
It add &#8216;
<p>Test</p>
<p>&#8216; before the div named &#8216;inner&#8217;.</p>
<p><strong>.text( )</strong><br />
This method get the combined text contents of each element in the set of matched elements, including their descendants.</p>
<p>Example :<br />
Consider the following code :</p>
<div class="demo-container">
<div class="demo-box">Demonstration Box</div>
<ul>
<li>list item 1</li>
<li>list <strong>item</strong> 2</li>
</ul></div>
<p>The $(&#8216;div.demo-container&#8217;).text()  will gives following output :</p>
<p>Demonstration Box list item 1 list item 2</p>
<p>DOM insertion, Outside</p>
<p>The methods falling in this category allow us to insert new content outside an existing element.</p>
<p><strong>.after( )</strong><br />
This method add element after each matched set element.</p>
<p>Example :<br />
$(&#8216;.inner&#8217;).after(&#8216;
<p>Test</p>
<p>&#8216;);<br />
It append the element &#8216;
<p>Test</p>
<p>&#8216; after every matched div whose name is &#8216;inner&#8217;.</p>
<p><strong>.before( )</strong><br />
This method add element before each matched set element.</p>
<p>Example :<br />
$(&#8216;.inner&#8217;).before(&#8216;
<p>Test</p>
<p>&#8216;);<br />
It add the element &#8216;
<p>Test</p>
<p>&#8216; before every matched div whose name is &#8216;inner&#8217;.</p>
<p><strong>.insertAfter( )</strong><br />
This method insert every element in the set of matched elements after the target.</p>
<p>Example :<br />
$(&#8216;
<p>Test</p>
<p>&#8216;).insertAfter(&#8216;.inner&#8217;);<br />
It append the element &#8216;
<p>Test</p>
<p>&#8216; after every matched div whose name is &#8216;inner&#8217;.</p>
<p><strong>.insertBefore( )</strong><br />
This method insert every element in the set of matched elements before the target.</p>
<p>Example :<br />
$(&#8216;
<p>Test</p>
<p>&#8216;).insertBefore(&#8216;.inner&#8217;);<br />
It add the element &#8216;
<p>Test</p>
<p>&#8216; before every matched div whose name is &#8216;inner&#8217;.</b></p>
]]></content:encoded>
			<wfw:commentRss>http://www.beasrilankan.com/2011/09/jquery-inserting-contentdom-insertion/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery manipulating attributes</title>
		<link>http://www.beasrilankan.com/2011/09/jquery-manipulating-attributes/</link>
		<comments>http://www.beasrilankan.com/2011/09/jquery-manipulating-attributes/#comments</comments>
		<pubDate>Wed, 28 Sep 2011 11:59:30 +0000</pubDate>
		<dc:creator>Sameera Thilakasiri</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[jQuery Examples]]></category>

		<guid isPermaLink="false">http://www.beasrilankan.com/?p=898</guid>
		<description><![CDATA[Manipulating CSS class attribute You can manipulate CSS class attribute using following methods : .addClass() You can add any css class to filtered elements through this method. Example : Following code add selected css class to last paragraph : .hasClass() Using this method , you can check any of the matched elements have provided css [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Manipulating CSS class attribute</strong></p>
<p>You can manipulate CSS class attribute using following methods :</p>
<p><strong>.addClass()</strong><br />
You can add any css class to filtered elements through this method.</p>
<p>Example :<br />
Following code add selected css class to last paragraph :<br />
<script>$("p:last").addClass("selected");</script></p>
<p><strong>.hasClass()</strong><br />
Using this method , you can check any of the matched elements have provided css class or not. If it has , it will reyurn &#8216;True&#8217; otherwise &#8216;False&#8217;.</p>
<p>Example :<br />
$(&#8216;#mydiv&#8217;).hasClass(&#8216;foo&#8217;)<br />
Above code checks whether the div &#8220;mydiv&#8221; have &#8216;foo&#8217; css class or not.</p>
<p><strong>.removeClass()</strong><br />
This method remove the css class from the set of matched element.</p>
<p>Example :<br />
Following code will remove &#8216;blue&#8217; css class from all even paragraphs :<br />
$(&#8220;p:even&#8221;).removeClass(&#8220;blue&#8221;)</p>
<p><strong>.toggleClass()</strong><br />
This method adds or removes a class from each element in the set of matched elements depending on either the class&#8217;s presence or the value of the switch argument.</p>
<p>Example :<br />
Following code will change the css class of clicked element :<br />
<script>
  $("p").click(function () {
  $(this).toggleClass("highlight");
  });
</script></p>
<p><strong>Manipulating general attributes :</strong></p>
<p>Given below methods are used to get and set the Dom attributes of elements :</p>
<p><strong>.attr()</strong><br />
This  method is used to get the attribute of the first element from the matched set of elements.</p>
<p>Example :<br />
Following code will get the &#8216;title &#8216; attribute of the first matched &#8216;em&#8217; :<br />
$(&#8220;em&#8221;).attr(&#8220;title&#8221;);</p>
<p><strong>.removeAttr()</strong><br />
This method is used to remove attribute from each element of the matched set.</p>
<p>Example :<br />
Consider the following code line :<br />
<button>Enable</button></p>
<input type="text" disabled="disabled" value="can't edit this" />
<p>The following code will enables the input next to it, on button click :</p>
<p>$(&#8220;button&#8221;).click(function () {<br />
  $(this).next().removeAttr(&#8220;disabled&#8221;)<br />
  .focus()<br />
  .val(&#8220;editable now&#8221;);<br />
});</p>
<p><strong>.text()</strong><br />
This method will get and combine the text of each matched elements by leaving their html tags.</p>
<p>Example :<br />
Consider the following code :<br />
div class=&#8221;demo-container&#8221;></p>
<div class="demo-box">Demonstration Box</div>
<ul>
<li>list item 1</li>
<li>list <strong>item</strong> 2</li>
</ul>
<p>The $(&#8216;div.demo-container&#8217;).text()will produce the following output :</p>
<p>Demonstration Box list item 1 list item 2</p>
<p>NOTE -The .text() method cannot be used on input elements. For input field text, use the .val() method.</p>
<p><strong>.val( )</strong><br />
This method will get the current value of the first element in the set of matched elements.</p>
<p>Following are some example of &#8216;.val()&#8217; :</p>
<p>$(&#8216;select.foo option:selected&#8217;).val();  // get the value from a dropdown select<br />
$(&#8216;select.foo&#8217;).val();  // get the value from a dropdown select even easier<br />
$(&#8216;input:checkbox:checked&#8217;).val();  // get the value from a checked checkbox<br />
$(&#8216;input:radio[name=bar]:checked&#8217;).val(); // get the value from a set of radio buttons</p>
]]></content:encoded>
			<wfw:commentRss>http://www.beasrilankan.com/2011/09/jquery-manipulating-attributes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery Tree traversal</title>
		<link>http://www.beasrilankan.com/2011/09/jquery-tree-traversal/</link>
		<comments>http://www.beasrilankan.com/2011/09/jquery-tree-traversal/#comments</comments>
		<pubDate>Sun, 11 Sep 2011 09:18:10 +0000</pubDate>
		<dc:creator>Sameera Thilakasiri</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[jQuery Examples]]></category>
		<category><![CDATA[jQuery Tree Traversal]]></category>

		<guid isPermaLink="false">http://www.beasrilankan.com/?p=895</guid>
		<description><![CDATA[.children() This method get a set of elements containing all of the unique immediate children of each of the matched set of elements. Example : $(&#8220;div&#8221;).children(&#8220;.selected&#8221;).css(&#8220;color&#8221;, &#8220;blue&#8221;); It finds all children with a class &#8220;selected&#8221; of each div. .closest( ) This method get a set of elements containing the closest parent element that matches the [...]]]></description>
			<content:encoded><![CDATA[<p><strong>.children()</strong><br />
This method get a set of elements containing all of the unique immediate children of each of the matched set of elements.</p>
<p>Example :<br />
$(&#8220;div&#8221;).children(&#8220;.selected&#8221;).css(&#8220;color&#8221;, &#8220;blue&#8221;);<br />
It finds all children with a class &#8220;selected&#8221; of each div.</p>
<p><strong>.closest( )</strong><br />
This method get a set of elements containing the closest parent element that matches the specified selector, the starting element included.</p>
<p>Example :<br />
$(&#8216;li.item-a&#8217;).closest(&#8216;ul&#8217;).css(&#8216;background-color&#8217;, &#8216;red&#8217;);<br />
This will change the background color of the closest &#8220;ul&#8221; .</p>
<p><strong>.find( )</strong><br />
This method searches for descendent elements that match the specified selectors.</p>
<p>Example :<br />
<script>$("p").find("span").css('color',' blue');</script></p>
<p><strong>.next()</strong><br />
This method get a set of elements containing the unique next siblings of each of the given set of elements.</p>
<p>Example :<br />
$(&#8220;p&#8221;).next(&#8220;.selected&#8221;).css(&#8220;background&#8221;, &#8220;yellow&#8221;);<br />
It finds the very next sibling of each paragraph. Keep only the ones with a class &#8220;selected&#8221;. </p>
<p><strong>.nextAll()</strong><br />
This method is used to find all sibling elements after the current element.</p>
<p>Example :<br />
$(&#8216;li.third-item&#8217;).nextAll().css(&#8216;background-color&#8217;, &#8216;red&#8217;); </p>
<p><strong>.nextUntil()</strong><br />
It finds all sibling elements after the current element.</p>
<p>Example : Consider the following code :</p>
<p><strong>.offsetParent()</strong><br />
This method get the closest ancestor element that is positioned. The .offsetParent() method allows us to search through the ancestors of these elements in the DOM tree and construct a new jQuery object wrapped around the closest positioned ancestor.</p>
<p><strong>.parent( )</strong><br />
This method get the direct parent of an element.</p>
<p>Example :<br />
It will find the parent element of each paragraph with a class &#8220;selected&#8221;.<br />
<script>$("p").parent(".selected").css("background", "yellow");</script></p>
<p><strong>.parents( )</strong><br />
This method gets the ancestors of each element in the current set of matched elements.</p>
<p>Example :<br />
$(&#8216;li.child-a&#8217;).parents().css(&#8216;background-color&#8217;, &#8216;red&#8217;) ;</p>
<p><strong>.parentsUntil()</strong><br />
The script below change the red background for the level-2 list and the item II.</p>
<p>$(&#8216;li.item-a&#8217;).parentsUntil(&#8216;.level-1&#8242;).css(&#8216;background-color&#8217;, &#8216;red&#8217;);</p>
<p><strong>.prev( )</strong><br />
This method will get the immediately preceding sibling of each element in the set of matched elements.</p>
<p>Example :<br />
$(&#8216;li.third-item&#8217;).prev().css(&#8216;background-color&#8217;, &#8216;red&#8217;);</p>
<p><strong>.prevAll()</strong><br />
This method will get all preceding sibling of each element in the set of matched elements.</p>
<p>The following script changes red background behind Node 1 and  Node 2.</p>
<p>Example :<br />
$(&#8216;li.third-item&#8217;).prevAll().css(&#8216;background-color&#8217;, &#8216;red&#8217;);</p>
<p><strong>.prevUntil( )</strong><br />
This method gets all preceding siblings of each element up to the provided &#8216;selector&#8217;.</p>
<p>Example:<br />
(&#8216;#term-2&#8242;).prevUntil(&#8216;dt&#8217;).css(&#8216;background-color&#8217;, &#8216;red&#8217;);<br />
This will get all the elements before &#8220;term-2&#8243; until it would not get &#8220;dt&#8221; .</p>
<p><strong>.siblings( )</strong><br />
This method gets the siblings of each element in the set of matched elements.</p>
<p>Example :<br />
$(&#8220;p&#8221;).siblings(&#8220;.selected&#8221;).css(&#8220;background&#8221;, &#8220;yellow&#8221;);<br />
It finds all siblings with a class &#8220;selected&#8221; of each &#8216;p&#8217;.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.beasrilankan.com/2011/09/jquery-tree-traversal/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Traversing through filtering</title>
		<link>http://www.beasrilankan.com/2011/09/traversing-through-filtering/</link>
		<comments>http://www.beasrilankan.com/2011/09/traversing-through-filtering/#comments</comments>
		<pubDate>Sun, 11 Sep 2011 09:04:45 +0000</pubDate>
		<dc:creator>Sameera Thilakasiri</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[jQuery Examples]]></category>

		<guid isPermaLink="false">http://www.beasrilankan.com/?p=892</guid>
		<description><![CDATA[Traversing through filtering Finding element by filtering has following methods : METHOD DESCRIPTION EXAMPLE . eq() Find Elements by index $(&#8220;li&#8221;).eq(2).addClass(&#8220;drop&#8221;); .filter() The filter( selector ) method can be used to filter out all elements from the set of matched elements that do not match the specified selector(s). $(&#8220;li&#8221;).filter(&#8220;.middle&#8221;).addClass(&#8220;drop&#8221;); .first() Reduce the set of matched [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Traversing through filtering</strong></p>
<p>Finding element by filtering has following methods :</p>
<table border="1">
<tbody>
<tr>
<td>METHOD</td>
<td>DESCRIPTION</td>
<td>EXAMPLE</td>
</tr>
<tr>
<td><strong>. eq()</strong></td>
<td>Find Elements by index</td>
<td>$(&#8220;li&#8221;).eq(2).addClass(&#8220;drop&#8221;);</td>
</tr>
<tr>
<td><strong> .filter() </strong></td>
<td>The filter( selector ) method can be used to filter out all elements<br />
from the set of matched elements that do not match the specified<br />
selector(s).</td>
<td>$(&#8220;li&#8221;).filter(&#8220;.middle&#8221;).addClass(&#8220;drop&#8221;);</td>
</tr>
<tr>
<td><strong> .first()</strong></td>
<td>Reduce the set of matched elements to the first in the set.</td>
<td>(&#8216;li&#8217;).first().css(&#8216;background-color&#8217;, &#8216;green&#8217;);</td>
</tr>
<tr>
<td><strong> .has() </strong></td>
<td>Reduce the set of matched elements to those that have a<br />
descendant that matches the selector or DOM element.</td>
<td>$(&#8220;ul&#8221;).has(&#8220;li&#8221;).addClass(&#8220;high&#8221;);</td>
</tr>
<tr>
<td><strong>.is() </strong></td>
<td>Check the current matched set of elements against a selector and<br />
return true if at least one of these elements matches the selector.</td>
<td>if ($(this).is(&#8220;:first-child&#8221;)) {}</td>
</tr>
<tr>
<td><strong> .last()</strong></td>
<td>Reduce the set of matched elements to the final one in the set.</td>
<td>$(&#8220;p span&#8221;).last().addClass(&#8216;highlight&#8217;)</td>
</tr>
<tr>
<td><strong>.map() </strong></td>
<td>Translate a set of elements in the jQuery object into another set of<br />
values in a jQuery array (which may, or may not contain elements).</td>
<td>We can get the sum of the values of the checked inputs:</p>
<p>var sum = 0;<br />
$(&#8216;input:checked&#8217;).map(function() {<br />
return sum += (this.value * 1);<br />
});</td>
</tr>
<tr>
<td><strong>.not() </strong></td>
<td>Remove elements from the set of matched elements.</td>
<td>$(&#8216;li&#8217;).not(&#8216;:even&#8217;).css(&#8216;background-color&#8217;, &#8216;red&#8217;);</td>
</tr>
<tr>
<td><strong>.slice() </strong></td>
<td><a href="http://www.tutorialspoint.com/jquery/traversal-slice.htm"></a>Selects a subset of the matched elements.</td>
<td>Selects all paragraphs, then slices the selection to include<br />
only the first element.<br />
$(&#8220;p&#8221;).slice(0, 1).wrapInner(&#8220;&lt;b&gt;&lt;/b&gt;&#8221;);</td>
</tr>
</tbody>
</table>
]]></content:encoded>
			<wfw:commentRss>http://www.beasrilankan.com/2011/09/traversing-through-filtering/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Form Element Selector</title>
		<link>http://www.beasrilankan.com/2011/09/form-element-selector/</link>
		<comments>http://www.beasrilankan.com/2011/09/form-element-selector/#comments</comments>
		<pubDate>Sun, 11 Sep 2011 08:07:38 +0000</pubDate>
		<dc:creator>Sameera Thilakasiri</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[jQuery Examples]]></category>
		<category><![CDATA[jQuery Tips and Tricks]]></category>

		<guid isPermaLink="false">http://www.beasrilankan.com/?p=890</guid>
		<description><![CDATA[: button Selector This type of selector is used to select all input buttons plus all button elements. Example : $(&#8220;:button&#8221;).css({background:&#8221;yellow&#8221;, border:&#8221;3px red solid&#8221;}); It changes the color and border of all buttons. : checkbox Selector It selects all the element of type checkbox. Example : $(&#8220;form input: checkbox&#8221;).wrap(&#8216;&#8216;).parent().css({background:&#8221;yellow&#8221;, border:&#8221;3px red solid&#8221;}); It select all [...]]]></description>
			<content:encoded><![CDATA[<p><strong>: button Selector</strong><br />
This type of selector is used to select all input buttons plus all button elements.</p>
<p>Example :<br />
$(&#8220;:button&#8221;).css({background:&#8221;yellow&#8221;, border:&#8221;3px red solid&#8221;});</p>
<p>It changes the color and border of all buttons.</p>
<p><strong>: checkbox Selector</strong><br />
It selects all the element of type checkbox.</p>
<p>Example :<br />
$(&#8220;form input: checkbox&#8221;).wrap(&#8216;<span></span>&#8216;).parent().css({background:&#8221;yellow&#8221;, border:&#8221;3px red solid&#8221;});</p>
<p>It select all the checkboxes of form and create a border around it and changes it&#8217;s color also.</p>
<p><strong>: checked Selector</strong><br />
The :checked selector works for checkboxes and radio buttons. For select elements, use the :selected selector. Matches all elements that are checked.</p>
<p>Example :<br />
$(&#8220;input: checked&#8221;).length;<br />
It gives the number of input elements that are checked.</p>
<p><strong>: disabled Selector</strong><br />
It selects all the elements that are disabled.</p>
<p>Example : It finds all input elements that are disabled.</p>
<form>
<input name="email" disabled="disabled" />
<input name="id" />
</form>
<p><script>$("input: disabled").val("this is it");</script></p>
<p><strong>: enabled Selector</strong><br />
It selects all the element that are enabled.</p>
<p>Example :<br />
It selects all the input element that are enabled .</p>
<form>
<input name="email" disabled="enabled" />
<input name="id" />
</form>
<p><script>$("input: enabled").val("this is it");</script></p>
<p><strong>: file Selector</strong><br />
It selects all the element of &#8216;file&#8217; type.</p>
<p>Example :<br />
$(&#8220;input: file&#8221;).css({background:&#8221;yellow&#8221;, border:&#8221;3px red solid&#8221;});</p>
<p><strong>: image Selector</strong><br />
It selects all the image type elements.</p>
<p>Example :<br />
$(&#8220;input: image&#8221;).css({background:&#8221;yellow&#8221;, border:&#8221;3px red solid&#8221;});</p>
<p><strong>: input Selector</strong><br />
It selects all the input elements. Input elements like input, textarea, select and button  etc.</p>
<p>Example :<br />
var allInputs = $(&#8220;:input&#8221;);</p>
<p>It counts the number of input elements and save it to &#8220;allInputs&#8221; variable.</p>
<p><strong>: password Selector</strong><br />
It selects all the element of type password.</p>
<p>Example :<br />
$(&#8220;input: password&#8221;).css({background:&#8221;yellow&#8221;, border:&#8221;3px red solid&#8221;});</p>
<p><strong>: radio Selector</strong><br />
This type of selector selects all element of radio type.</p>
<p>Example :<br />
$(&#8220;form input: radio&#8221;).css({background:&#8221;yellow&#8221;});</p>
<p><strong>: reset Selector</strong><br />
This type of selector selects all element of radio type.</p>
<p>Example :<br />
$(&#8220;input: reset&#8221;).css({background:&#8221;yellow&#8221;, border:&#8221;3px red solid&#8221;});</p>
<p><strong>: submit Selector</strong><br />
This type of selector selects all element of submit type.</p>
<p>Example :<br />
$(&#8220;td :submit&#8221;).parent(&#8216;td&#8217;).css({background:&#8221;yellow&#8221;, border:&#8221;3px red solid&#8221;})</p>
<p>It changes the background color and border of all the &#8216;submit&#8217; type whose parent is &#8216; td &#8216;.</p>
<p><strong>: text Selector</strong><br />
It selects all element of type submit .</p>
<p>Example :<br />
$(&#8220;form input: text&#8221;).css({background:&#8221;yellow&#8221;, border:&#8221;3px red solid&#8221;});<br />
It selects all text inputs :</p>
<p><strong>: selected Selector</strong><br />
It selects all the elements that are selected.</p>
<p>Example:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;body&gt;
&lt;select name=&quot;cloths&quot; multiple=&quot;multiple&quot;&gt;
&lt;option&gt;Shirt&lt;/option&gt;
&lt;option selected=&quot;selected&quot;&gt;T-Shirt&lt;/option&gt;
&lt;option&gt;Jeans&lt;/option&gt;
&lt;option selected=&quot;selected&quot;&gt;Trousers&lt;/option&gt;
&lt;option&gt;Skirts&lt;/option&gt;
&lt;option&gt;Coats&lt;/option&gt;
&lt;/select&gt;

&lt;div&gt;&lt;/div&gt;
You can select multiple option by pressing &quot;ctrl&quot; key. &lt;br&gt;Can deselect the option by clicking on it.
&lt;script&gt;
$(&quot;select&quot;).change(function () {
    var str = &quot;YOU SELECTED :&quot;;
    $(&quot;select option:selected&quot;).each(function () {
       str += $(this).text() + &quot; &quot;;
    });
    $(&quot;div&quot;).text(str);
})
&lt;/script&gt;
&lt;/body&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.beasrilankan.com/2011/09/form-element-selector/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

