<?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>ViralPatel.net &#187; JavaScript</title> <atom:link href="http://viralpatel.net/blogs/category/javascript/feed" rel="self" type="application/rss+xml" /><link>http://viralpatel.net/blogs</link> <description>Tutorials, Java, J2EE, Struts, AJAX, JavaScript, CSS, Web 2.0, MySQL, Articles</description> <lastBuildDate>Tue, 24 Jan 2012 13:45:10 +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>STOP SOPA JQuery Plugin</title><link>http://viralpatel.net/blogs/2012/01/stopsopa-jquery-plugin.html</link> <comments>http://viralpatel.net/blogs/2012/01/stopsopa-jquery-plugin.html#comments</comments> <pubDate>Wed, 18 Jan 2012 11:48:30 +0000</pubDate> <dc:creator>Viral Patel</dc:creator> <category><![CDATA[JavaScript]]></category><guid isPermaLink="false">http://viralpatel.net/blogs/?p=2641</guid> <description><![CDATA[Right now, Internet is experiencing the biggest protest since its inception. We have seen people protesting against Companies, Government, Dictators etc. Also Internet has become their voices in form of Twitter &#038; Facebook. But today we saw something completely new. Major websites such as Wikipedia and Google are openly demonstrating their protest against new legislation [...]]]></description> <content:encoded><![CDATA[<p><img src="http://img.viralpatel.net/2012/01/stop-sopa.png" alt="stop-sopa" title="stop-sopa" width="143" height="140" class="alignright size-full wp-image-2642" />Right now, Internet is experiencing the biggest protest since its inception. We have seen people protesting against Companies, Government, Dictators etc. Also Internet has become their voices in form of Twitter &#038; Facebook.</p><p>But today we saw something completely new. Major websites such as Wikipedia and Google are openly demonstrating their protest against new legislation bills SOPA and PIPA which is right now being voted in U.S. Congress. The Senate will begin voting on January 24th.</p><p>Well, if you do support the STOPSOPA cause here is a coolest thing to do. Add a black colored STOPSOPA banner on your website!!!!</p><p>Here&#8217;s is the deal. I have created a simple JQuery plugin which you can include at the end of your website. And voila!!! It adds black color banner on top of your webpage saying &#8220;<strong>I  support #STOPSOPA campaign. Do you?</strong>&#8221;</p><p>Just include below javascript at the end of webpage:</p><pre class="brush: jscript; title: ; notranslate">
&lt;script type=&quot;text/javascript&quot; src=&quot;http://viralpatel.net/stopsopa/jquery.stopsopa.js&quot;&gt;&lt;/script&gt;
&lt;script&gt;
	$(document).ready(function() { $(this).stopsopa() });
&lt;/script&gt;
</pre><p>That&#8217;s All!!</p><p>Please note that I haven&#8217;t tested this plugin for cross browsers. Let me know in case you find difficulties in adding.</p><style>.demobtns
a{background:-moz-linear-gradient(center top , #BDED82, #83CC29) repeat scroll 0 0 transparent;border:1px
solid #5F961A;border-radius:7px 7px 7px 7px;color:#5F961A;display:inline-block;font-size:18px;margin-right:5px;padding:10px
9px}</style><div class="demobtns"> <a target="_new" href="http://viralpatel.net/stopsopa/">Demo</a></div><p><br/></p><h2>StopSOPA WordPress Plugin</h2><p>I have quickly assemble a small wordpress plugin to add StopSOPA message on your blog. Just in case you dont want to hack your lovely theme and add those javascripts, you can simply enable this plugin and voila; you have your own StopSOPA Blackout message.</p><p><strong>Update:</strong> The StopSOPA plugin is now available at WordPress Plugin Directory: <a rel="nofollow" href="http://wordpress.org/extend/plugins/stopsopa/"><strong>StopSOPA WP Plugin</strong></a></p><div class="demobtns"> <a target="_new" href="http://viralpatel.net/stopsopa/stopsopa.zip">Download StopSOPA Plugin</a></div><p><br/></p><div id="relatedpost"><h2  class="related_post_title">Related Posts</h2><ul class="related_post"><li><a href="http://viralpatel.net/blogs/2012/01/create-zip-file-javascript.html" title="Create ZIP Files in JavaScript">Create ZIP Files in JavaScript</a></li><li><a href="http://viralpatel.net/blogs/2010/11/multiple-checkbox-select-deselect-jquery-tutorial-example.html" title="Multiple Checkbox Select/Deselect using jQuery &#8211; Tutorial with Example">Multiple Checkbox Select/Deselect using jQuery &#8211; Tutorial with Example</a></li><li><a href="http://viralpatel.net/blogs/2010/01/javascript-array-remove-element-js-array-delete-element.html" title="JavaScript Array Remove an Element ">JavaScript Array Remove an Element </a></li><li><a href="http://viralpatel.net/blogs/2009/11/disable-back-button-browser-javascript.html" title="Disable Back Button in Browser using JavaScript">Disable Back Button in Browser using JavaScript</a></li><li><a href="http://viralpatel.net/blogs/2009/10/create-search-engine-google-custom-search-api.html" title="Create your own Search Engine(Interface) using Google Custom Search API">Create your own Search Engine(Interface) using Google Custom Search API</a></li><li><a href="http://viralpatel.net/blogs/2009/09/default-text-label-textbox-javascript-jquery.html" title="Default Text Label in Textbox using JavaScript/jQuery">Default Text Label in Textbox using JavaScript/jQuery</a></li><li><a href="http://viralpatel.net/blogs/2009/08/javascript-mouse-scroll-event-down-example.html" title="Mouse Scroll Event Up/Down Example in JavaScript">Mouse Scroll Event Up/Down Example in JavaScript</a></li></ul></div>]]></content:encoded> <wfw:commentRss>http://viralpatel.net/blogs/2012/01/stopsopa-jquery-plugin.html/feed</wfw:commentRss> <slash:comments>6</slash:comments> </item> <item><title>Facebook Style Scroll Fixed Header in JQuery</title><link>http://viralpatel.net/blogs/2012/01/scroll-fix-header-jquery-facebook.html</link> <comments>http://viralpatel.net/blogs/2012/01/scroll-fix-header-jquery-facebook.html#comments</comments> <pubDate>Wed, 11 Jan 2012 12:22:41 +0000</pubDate> <dc:creator>Viral Patel</dc:creator> <category><![CDATA[JavaScript]]></category> <category><![CDATA[JQuery]]></category> <category><![CDATA[facebook]]></category> <category><![CDATA[header]]></category> <category><![CDATA[JQuery Events]]></category> <category><![CDATA[mouse scroll event]]></category><guid isPermaLink="false">http://viralpatel.net/blogs/?p=2613</guid> <description><![CDATA[While doing some UI changes of a website, we had to implement a FIX header which remains fix on top of screen while scrolling. Facebook has a similar header which remains on top of content. Now for this, there are number of jQuery plugins available out there! But in our case we weren&#8217;t allowed to [...]]]></description> <content:encoded><![CDATA[<p>While doing some UI changes of a website, we had to implement a FIX header which remains fix on top of screen while scrolling. Facebook has a similar header which remains on top of content.</p><p>Now for this, there are number of jQuery plugins available out there! But in our case we weren&#8217;t allowed to add any new plugins to the technology stack of application (I know it sucks <img src='http://viralpatel.net/blogs/wp-includes/images/smilies/icon_sad.gif' alt=':-(' class='wp-smiley' /> ). So here is a small JQuery based solution to make a DIV of header fixed on top of the screen while scrolling.</p><p><strong>Related:</strong> <a href="http://viralpatel.net/blogs/2009/08/javascript-mouse-scroll-event-down-example.html">Mouse Scroll Events in JQuery</a></p><h2>The HTML</h2><p>Below is the HTML code. It contain a simple div #header which we want to freeze at the top. Note that we have included JQuery directly from jquery.com site (In my application we have included older version of jquery from out tech stack).</p><pre class="brush: xml; highlight: [8]; title: ; notranslate">
&lt;HTML&gt;
&lt;HEAD&gt;
	&lt;script type=&quot;text/javascript&quot; src=&quot;http://code.jquery.com/jquery-latest.js&quot;&gt;&lt;/script&gt;
	&lt;title&gt;Scroll Fixed Header like Facebook in JQuery - viralpatel.net&lt;/title&gt;
&lt;/HEAD&gt;
&lt;BODY&gt;

&lt;div id=&quot;header&quot;&gt;
	&lt;h1&gt;Scroll Fix Header like Facebook in JQuery&lt;/h1&gt;
&lt;/div&gt;

&lt;p&gt;Some dumb text to add scrolling in page &lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;/p&gt;
&lt;p&gt;Some more dumb text to add scrolling in page &lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;/p&gt;
&lt;p&gt;Some more dumb text to add scrolling in page &lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;/p&gt;
&lt;p&gt;Some more dumb text to add scrolling in page &lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;/p&gt;

&lt;/BODY&gt;
&lt;/HTML&gt;
</pre><p>In above HTML, we added few lines &#8220;Some dumb text to add&#8230;&#8221; just to make page scrollable.</p><h2>The JQuery</h2><p>The JQuery code is pretty straight forward. Take a look:</p><pre class="brush: jscript; highlight: [4]; title: ; notranslate">
&lt;SCRIPT&gt;
$(document).ready(function() {

	var div = $('#header');
	var start = $(div).offset().top;

	$.event.add(window, &quot;scroll&quot;, function() {
		var p = $(window).scrollTop();
		$(div).css('position',((p)&gt;start) ? 'fixed' : 'static');
		$(div).css('top',((p)&gt;start) ? '0px' : '');
	});

});
&lt;/SCRIPT&gt;
</pre><p>We have added an event listener to &#8220;<strong>scroll</strong>&#8221; event. This handler function gets called each time scroll event is fired in browser.</p><p>Now we select the header element (highlighted in above code) and simply do some position stuff. We make the header div&#8217;s position <strong>fixed</strong> of <strong>static</strong> depending upon the state of scroll position. Also the <strong>top</strong> attribute is set to 0px in case we want to make it fix, when page is scrolled down.</p><h2>Online Demo</h2><style>.demobtns
a{background:-moz-linear-gradient(center top , #BDED82, #83CC29) repeat scroll 0 0 transparent;border:1px
solid #5F961A;border-radius:7px 7px 7px 7px;color:#5F961A;display:inline-block;font-size:18px;margin-right:5px;padding:10px
9px}</style><div class="demobtns"> <a target="_new" href="http://viralpatel.net/blogs/demo/jquery/scroll-fix-header-facebook/">Demo</a> <a target="_new" href="http://viralpatel.net/blogs/demo/jquery/scroll-fix-header-facebook/download.zip">Download</a></div><p><br/></p><div id="relatedpost"><h2  class="related_post_title">Related Posts</h2><ul class="related_post"><li><a href="http://viralpatel.net/blogs/2009/12/jquery-live-events.html" title="jQuery Live Event">jQuery Live Event</a></li><li><a href="http://viralpatel.net/blogs/2009/04/tutorial-handle-browser-events-using-jquery-javascript-framework.html" title="Tutorial: Handle browser events using jQuery JavaScript framework">Tutorial: Handle browser events using jQuery JavaScript framework</a></li><li><a href="http://viralpatel.net/blogs/2011/02/clearable-textbox-jquery.html" title="Create a Clearable TextBox with jQuery">Create a Clearable TextBox with jQuery</a></li><li><a href="http://viralpatel.net/blogs/2011/02/jquery-get-text-element-without-child-element.html" title="jQuery: Get the Text of Element without Child Element">jQuery: Get the Text of Element without Child Element</a></li><li><a href="http://viralpatel.net/blogs/2011/01/first-play-framework-gae-siena-application-tutorial-example.html" title="Your first Play! &#8211; GAE &#8211; Siena application: Tutorial with Example">Your first Play! &#8211; GAE &#8211; Siena application: Tutorial with Example</a></li><li><a href="http://viralpatel.net/blogs/2010/12/dynamically-shortened-text-show-more-link-jquery.html" title="Dynamically shortened Text with &#8220;Show More&#8221; link using jQuery">Dynamically shortened Text with &#8220;Show More&#8221; link using jQuery</a></li><li><a href="http://viralpatel.net/blogs/2010/12/jquery-ajax-handling-unauthenticated-request-ajax.html" title="jQuery Ajax &#8211; Handling unauthenticated requests via Ajax">jQuery Ajax &#8211; Handling unauthenticated requests via Ajax</a></li></ul></div>]]></content:encoded> <wfw:commentRss>http://viralpatel.net/blogs/2012/01/scroll-fix-header-jquery-facebook.html/feed</wfw:commentRss> <slash:comments>6</slash:comments> </item> <item><title>Create ZIP Files in JavaScript</title><link>http://viralpatel.net/blogs/2012/01/create-zip-file-javascript.html</link> <comments>http://viralpatel.net/blogs/2012/01/create-zip-file-javascript.html#comments</comments> <pubDate>Tue, 10 Jan 2012 08:44:11 +0000</pubDate> <dc:creator>Viral Patel</dc:creator> <category><![CDATA[JavaScript]]></category> <category><![CDATA[gzip]]></category> <category><![CDATA[Javascript Compression]]></category><guid isPermaLink="false">http://viralpatel.net/blogs/?p=2599</guid> <description><![CDATA[Zip is a very useful file type if I must say most used. It is the most used file format for data compression and archiving. There are number utilities available to create/generate Zip file. Also most of the programming languages comes up with API supporting to generate Zip files. I have written a couple of [...]]]></description> <content:encoded><![CDATA[<p><img src="http://img.viralpatel.net/2012/01/zip-box-example.png" alt="zip-box-example" title="zip-box-example" width="244" height="226" class="alignleft size-full wp-image-2607" />Zip is a very useful file type if I must say most used. It is the most used file format for data compression and archiving. There are number utilities available to create/generate Zip file. Also most of the programming languages comes up with API supporting to generate Zip files. I have written a couple of articles for zipping/unzipping files in <a href="http://viralpatel.net/blogs/2008/11/creating-zip-and-jar-files-in-java.html">Java</a> and <a href="http://viralpatel.net/blogs/2009/05/15-very-useful-php-code-snippets-for-php-developers.html">PHP</a>.</p><p>While browsing internet, I came up to a very interesting website <a rel="nofollow" href="http://jszip.stuartk.co.uk/">http://jszip.stuartk.co.uk/</a>. This is JavaScript based API to generate Zip files on the fly! It&#8217;s very simple to use. All you need to do is to include the jszip javascript file in your HTML document and call its API.</p><p>Let us see how to generate a simple ZIP file in JavaScript.</p><h2>Hello world ZIP in JavaScript</h2><p>Let us create a helloworld ZIP file which contains two text files, hello1.txt and hello2.txt.</p><h4>Step 1. Import jszip JavaScript</h4><p>Include the jszip javascript file in the HTML document where you want to generate ZIP files. You can download the jszip package and include it in HTML or directly include the jszip javascript through git repository.</p><pre class="brush: xml; gutter: false; title: ; notranslate">
&lt;script type=&quot;text/javascript&quot;
		src=&quot;https://raw.github.com/Stuk/jszip/master/jszip.js&quot;&gt;&lt;/script&gt;
</pre><h4>Step 2. Generate Hello world ZIP</h4><p>Following code snippet is HTML file which contains Javascript code to generate ZIP file.</p><pre class="brush: xml; title: ; notranslate">
&lt;HTML&gt;
&lt;HEAD&gt;
	&lt;script type=&quot;text/javascript&quot; src=&quot;jszip.js&quot;&gt;&lt;/script&gt;
&lt;/HEAD&gt;

&lt;BODY&gt;

	&lt;input type=&quot;button&quot; onclick=&quot;create_zip()&quot; value=&quot;Create Zip&quot;&gt;&lt;/input&gt;

&lt;/BODY&gt;
&lt;SCRIPT&gt;

function create_zip() {
	var zip = new JSZip();
	zip.add(&quot;hello1.txt&quot;, &quot;Hello First World\n&quot;);
	zip.add(&quot;hello2.txt&quot;, &quot;Hello Second World\n&quot;);
	content = zip.generate();
	location.href=&quot;data:application/zip;base64,&quot; + content;
}

&lt;/SCRIPT&gt;
&lt;/HTML&gt;
</pre><p>In above code snippet, we have a button &#8220;Create Zip&#8221; which calls javascript function create_zip(). This function calls jszip API to generate ZIP file.</p><h2>Online Demo</h2><p>Check the online demo.</p><style>.demobtns
a{background-color:#B9E67E;border:1px
solid #538312;border-radius:7px 7px 7px 7px;color:#538312;display:inline-block;font-size:18px;margin-right:5px;padding:10px
9px}</style><div class="demobtns"> <a target="_new" href="http://viralpatel.net/blogs/demo/js/create-zip-file-javascript/">Demo</a> <a target="_new" href="http://viralpatel.net/blogs/demo/js/create-zip-file-javascript/download.zip">Download</a></div><h2>Filename Problem</h2><p>If you have tried above demo in Firefox or Safari, you may have noticed the file that is generated has weird name: e.g. b77AewqA7.zip.part. This is because of existing bugs <a rel="nofollow" href="https://bugzilla.mozilla.org/show_bug.cgi?id=367231">367231</a> and <a rel="nofollow" href="https://bugzilla.mozilla.org/show_bug.cgi?id=532230">532230</a>. However jszip comes with a unique workaround of this problem by using <a rel="nofollow" href="http://www.downloadify.info/">Downloadify</a>.</p><pre class="brush: jscript; title: ; notranslate">
zip = new JSZip();
zip.add(&quot;Hello.&quot;, &quot;hello.txt&quot;);
Downloadify.create('downloadify',{
...
  data: function(){
    return zip.generate();
  },
...
  dataType: 'base64'
});
</pre><p>Hope this basic demo will help you get going with Client side ZIP file creation in JavaScript.</p><div id="relatedpost"><h2  class="related_post_title">Related Posts</h2><ul class="related_post"><li><a href="http://viralpatel.net/blogs/2009/02/compress-php-css-js-javascript-optimize-website-performance.html" title="Compress PHP, CSS, JavaScript(JS) &#038; Optimize website performance.">Compress PHP, CSS, JavaScript(JS) &#038; Optimize website performance.</a></li><li><a href="http://viralpatel.net/blogs/2008/12/increase-performance-of-website-by-compressing-javascript.html" title="Increase performance of website by compressing JavaScript.">Increase performance of website by compressing JavaScript.</a></li><li><a href="http://viralpatel.net/blogs/2012/01/stopsopa-jquery-plugin.html" title="STOP SOPA JQuery Plugin">STOP SOPA JQuery Plugin</a></li><li><a href="http://viralpatel.net/blogs/2010/11/multiple-checkbox-select-deselect-jquery-tutorial-example.html" title="Multiple Checkbox Select/Deselect using jQuery &#8211; Tutorial with Example">Multiple Checkbox Select/Deselect using jQuery &#8211; Tutorial with Example</a></li><li><a href="http://viralpatel.net/blogs/2010/01/javascript-array-remove-element-js-array-delete-element.html" title="JavaScript Array Remove an Element ">JavaScript Array Remove an Element </a></li><li><a href="http://viralpatel.net/blogs/2009/11/disable-back-button-browser-javascript.html" title="Disable Back Button in Browser using JavaScript">Disable Back Button in Browser using JavaScript</a></li><li><a href="http://viralpatel.net/blogs/2009/10/create-search-engine-google-custom-search-api.html" title="Create your own Search Engine(Interface) using Google Custom Search API">Create your own Search Engine(Interface) using Google Custom Search API</a></li></ul></div>]]></content:encoded> <wfw:commentRss>http://viralpatel.net/blogs/2012/01/create-zip-file-javascript.html/feed</wfw:commentRss> <slash:comments>2</slash:comments> </item> <item><title>Create a Clearable TextBox with jQuery</title><link>http://viralpatel.net/blogs/2011/02/clearable-textbox-jquery.html</link> <comments>http://viralpatel.net/blogs/2011/02/clearable-textbox-jquery.html#comments</comments> <pubDate>Wed, 23 Feb 2011 23:50:54 +0000</pubDate> <dc:creator>Viral Patel</dc:creator> <category><![CDATA[JavaScript]]></category> <category><![CDATA[JQuery]]></category> <category><![CDATA[jquery tips tricks]]></category> <category><![CDATA[jquery ui tutorial]]></category><guid isPermaLink="false">http://viralpatel.net/blogs/?p=2159</guid> <description><![CDATA[Recently I came across a wonderful article by David Walsh on Clearable Textboxes with Dojo Toolkit [link]. This is a simple implementation where a clear button (x) added in a textbox which lets user to clear the content of the textbox. I have seen this simple feature in many websites and feel its very useful [...]]]></description> <content:encoded><![CDATA[<p><img src="http://img.viralpatel.net/2011/02/clearable-textbox-jquery.png" alt="clearable-textbox-jquery" title="clearable-textbox-jquery" width="335" height="46" class="aligncenter size-full wp-image-2160" /><br /> <br /> Recently I came across a wonderful article by David Walsh on Clearable Textboxes with Dojo Toolkit [<a rel="nofollow" target="_new" href="http://davidwalsh.name/dojo-textbox">link</a>]. This is a simple implementation where a clear button (x) added in a textbox which lets user to clear the content of the textbox. I have seen this simple feature in many websites and feel its very useful to have. It increase the usability of form.</p><p>I thought to implement the same feature using jQuery. Here is a simple plugin that I wrote to add clearable feature to any textbox in your HTML form. All you need is to call clearable() method on the textbox. For example.</p><pre class="brush: xml; title: ; notranslate">
...
...
&lt;script type=&quot;text/javascript&quot; src=&quot;jquery.clearable.js&quot;&gt;&lt;/script&gt;
&lt;link rel=&quot;stylesheet&quot; href=&quot;jquery.clearable.css&quot; type=&quot;text/css&quot; media=&quot;screen&quot; /&gt;

...
...

&lt;input type=&quot;text&quot;  class=&quot;foo&quot;&gt;&lt;/input&gt;

&lt;script&gt;
$(document).ready(function() {
	$('.foo').clearable();
});
&lt;/scrip&gt;
</pre><p>In above example we included jquery.clearable plugin javascript and stylesheet files. Then called .clearable() method on the textboxes we want to add clearable feature. That&#8217;s it <img src='http://viralpatel.net/blogs/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /></p><p>Let us go through the code and see what exactly goes behind the scene in jquery clearable plugin.</p><h2>The CSS</h2><p>We use following stylesheet classes internally to display the</p><pre class="brush: css; title: ; notranslate">
.divclearable {
	border: 1px solid #888;
	display: -moz-inline-stack;
	display: inline-block;
	zoom:1;
	*display:inline;
	padding-right:5px;
	vertical-align:middle;
}

a.clearlink {
	background: url(&quot;close-button.png&quot;) no-repeat scroll 0 0 transparent;
	background-position: center center;
	cursor: pointer;
	display: -moz-inline-stack;
	display: inline-block;
	zoom:1;
	*display:inline;
	height: 12px;
	width: 12px;
	z-index: 2000;
	border: 0px solid;
}
</pre><p>There are two css classes we uses in clearable plugin. First one is for a wrapper DIV which wraps around the textbox and clear button (x). And the style class is for clear button (x).</p><h2>The JavaScript</h2><p>The important bit of the plugin is javascript code that creates clearable effect. For everytextbox, we wrap it around a DIV container and also add one clear button (x) in this container DIV.</p><p>Here is the jQuery code:</p><pre class="brush: jscript; title: ; notranslate">
	$(this).css({'border-width': '0px', 'outline': 'none'})
		.wrap('&lt;div id=&quot;sq&quot; class=&quot;divclearable&quot;&gt;&lt;/div&gt;')
		.parent()
		.attr('class', $(this).attr('class') + ' divclearable')
		.append('&lt;a class=&quot;clearlink&quot; href=&quot;javascript:&quot;&gt;&lt;/a&gt;');

	$('.clearlink')
		.attr('title', 'Click to clear this textbox')
		.click(function() {

			$(this).prev().val('').focus();

	});
</pre><p>In above javascript code, we do:</p><ol><li>Remove border and outline of the textbox where we want to add clearable feature</li><li>Create a DIV wrapper and wrap the textbox with that DIV</li><li>Add the textbox style class to DIV, so the border / background etc that are specified on textbox are added to DIV</li><li>Create a link for clear text(x) and append in the DIV</li></ol><p>Also for each clear text link (x) we add an onclick handler where we clear the corresponding textbox and set focus in it.</p><h2>Try Demo</h2><p><a target="_new" href="http://viralpatel.net/blogs/demo/jquery/clearable-textboxes/"><b>View demo</b></a><br /> <br /> <iframe src="http://viralpatel.net/blogs/demo/jquery/clearable-textboxes/demo.html" width="100%" height="250px"></iframe></p><h2>Download jQuery Clearable Plugin</h2><p><a href="http://viralpatel.net/blogs/demo/jquery/clearable-textboxes/jquery.clearable.zip">Clearable plugin (zip, 4kb)</a></p><div id="relatedpost"><h2  class="related_post_title">Related Posts</h2><ul class="related_post"><li><a href="http://viralpatel.net/blogs/2011/02/jquery-get-text-element-without-child-element.html" title="jQuery: Get the Text of Element without Child Element">jQuery: Get the Text of Element without Child Element</a></li><li><a href="http://viralpatel.net/blogs/2010/11/multiple-checkbox-select-deselect-jquery-tutorial-example.html" title="Multiple Checkbox Select/Deselect using jQuery &#8211; Tutorial with Example">Multiple Checkbox Select/Deselect using jQuery &#8211; Tutorial with Example</a></li><li><a href="http://viralpatel.net/blogs/2009/09/default-text-label-textbox-javascript-jquery.html" title="Default Text Label in Textbox using JavaScript/jQuery">Default Text Label in Textbox using JavaScript/jQuery</a></li><li><a href="http://viralpatel.net/blogs/2009/09/create-accordion-menu-jquery.html" title="Create Simplest Accordion Menu using jQuery">Create Simplest Accordion Menu using jQuery</a></li><li><a href="http://viralpatel.net/blogs/2009/08/20-top-jquery-tips-tricks-for-jquery-programmers.html" title="20 Top jQuery Tips &#038; Tricks for jQuery Programmers">20 Top jQuery Tips &#038; Tricks for jQuery Programmers</a></li><li><a href="http://viralpatel.net/blogs/2009/05/implement-drag-and-drop-example-jquery-javascript-html.html" title="Drag and Drop Example using jQuery JavaScript in HTML">Drag and Drop Example using jQuery JavaScript in HTML</a></li><li><a href="http://viralpatel.net/blogs/2009/04/jquery-tabs-create-html-tabs-using-jquery-ui.html" title="jQuery tabs: Create HTML tabs using jQuery UI">jQuery tabs: Create HTML tabs using jQuery UI</a></li></ul></div>]]></content:encoded> <wfw:commentRss>http://viralpatel.net/blogs/2011/02/clearable-textbox-jquery.html/feed</wfw:commentRss> <slash:comments>1</slash:comments> </item> <item><title>jQuery: Get the Text of Element without Child Element</title><link>http://viralpatel.net/blogs/2011/02/jquery-get-text-element-without-child-element.html</link> <comments>http://viralpatel.net/blogs/2011/02/jquery-get-text-element-without-child-element.html#comments</comments> <pubDate>Wed, 02 Feb 2011 11:30:46 +0000</pubDate> <dc:creator>Viral Patel</dc:creator> <category><![CDATA[JavaScript]]></category> <category><![CDATA[JQuery]]></category> <category><![CDATA[How-To]]></category> <category><![CDATA[jquery plugin]]></category> <category><![CDATA[jquery tips tricks]]></category><guid isPermaLink="false">http://viralpatel.net/blogs/?p=2153</guid> <description><![CDATA[While writing code in jQuery, I often use .text() method to get the content of any element from DOM. This function is straight forward, it strips off all the html element from a selected element and returns the remaining text. So for below element the .text() method will return &#8220;A quick brown fox&#8221;. But by [...]]]></description> <content:encoded><![CDATA[<p><img src="http://img.viralpatel.net/jquery-logo.png" alt="jquery-logo" title="jquery-logo" width="236" height="85" class="alignleft size-full wp-image-1108" />While writing code in jQuery, I often use <code>.text()</code> method to get the content of any element from DOM. This function is straight forward, it strips off all the html element from a selected element and returns the remaining text.</p><p>So for below element the .text() method will return &#8220;A quick brown fox&#8221;.</p><pre class="brush: xml; title: ; notranslate">
&lt;div id=&quot;foo&quot;&gt;
	A quick brown fox
&lt;/div&gt;
&lt;script&gt;
	$(&quot;#foo&quot;).text(); //return &quot;A quick brown fox&quot;
&lt;/script&gt;
</pre><p>But by the definition the .text() returns all the text inside an element. What if you have an element which contains child elements and you want text of only the selected element ignoring all the child elements?</p><p>For example: Here we have a DIV which has text &#8220;A quick brown fox&#8221; and also contain a child DIV which has text &#8220;jumps over a lazy dog!&#8221;</p><pre class="brush: xml; title: ; notranslate">
&lt;div id=&quot;foo&quot;&gt;
	A quick brown fox
	&lt;div id=&quot;bar&quot;&gt;
		jumps over a lazy dog!
	&lt;/div&gt;
&lt;/div&gt;

&lt;script&gt;
	$(&quot;#foo&quot;).text(); //return &quot;A quick brown fox jumps over a lazy dog!&quot;
&lt;/script&gt;
</pre><p>What if you just want &#8220;A quick brown fox&#8221; and wants to ignore all the child element? Well, here is a simple solution using jQuery.</p><pre class="brush: jscript; title: ; notranslate">
&lt;script&gt;
	$(&quot;#foo&quot;)
		.clone()	//clone the element
		.children()	//select all the children
		.remove()	//remove all the children
		.end()	//again go back to selected element
		.text();	//get the text of element
&lt;/script&gt;
</pre><p>We clone the element that you want text of, then remove all the child elements from this cloned element and then returns the text of element.</p><p>I have written a small jQuery plugin &#8220;<strong>justtext</strong>&#8221; which you can use to get the text of element and ignore all child elements. Here is the code of <strong>justtext</strong> plugin.</p><pre class="brush: jscript; title: ; notranslate">
jQuery.fn.justtext = function() {

	return $(this)	.clone()
			.children()
			.remove()
			.end()
			.text();

};
</pre><p>So the usage is just by calling <code>justtext()</code> method on any element.</p><pre class="brush: xml; title: ; notranslate">
&lt;!-- include justtext jquery plugin --&gt;
&lt;script src=&quot;http://viralpatel.net/blogs/demo/jquery/get-text-without-child-element/jquery.justtext.1.0.js&quot;&gt;&lt;/script&gt;

&lt;div id=&quot;foo&quot;&gt;
	A quick brown fox
	&lt;div id=&quot;bar&quot;&gt;
		jumps over a lazy dog!
	&lt;/div&gt;
&lt;/div&gt;

&lt;script&gt;
	$(&quot;#foo&quot;).justtext(); //return &quot;A quick brown fox&quot;
&lt;/script&gt;
</pre><h2>Online Demo</h2><p><a target="_new" href="http://viralpatel.net/blogs/demo/jquery/get-text-without-child-element/">Online Demo Link</a><br /> <iframe src="http://viralpatel.net/blogs/demo/jquery/get-text-without-child-element/demo.html" width="100%" height="250px"></iframe></p><div id="relatedpost"><h2  class="related_post_title">Related Posts</h2><ul class="related_post"><li><a href="http://viralpatel.net/blogs/2010/11/multiple-checkbox-select-deselect-jquery-tutorial-example.html" title="Multiple Checkbox Select/Deselect using jQuery &#8211; Tutorial with Example">Multiple Checkbox Select/Deselect using jQuery &#8211; Tutorial with Example</a></li><li><a href="http://viralpatel.net/blogs/2011/02/clearable-textbox-jquery.html" title="Create a Clearable TextBox with jQuery">Create a Clearable TextBox with jQuery</a></li><li><a href="http://viralpatel.net/blogs/2010/12/dynamically-shortened-text-show-more-link-jquery.html" title="Dynamically shortened Text with &#8220;Show More&#8221; link using jQuery">Dynamically shortened Text with &#8220;Show More&#8221; link using jQuery</a></li><li><a href="http://viralpatel.net/blogs/2010/01/jquery-resizable-draggable-resize-drag-tutorial-example.html" title="jQuery Resizable and Draggable Tutorial with Example">jQuery Resizable and Draggable Tutorial with Example</a></li><li><a href="http://viralpatel.net/blogs/2009/09/create-accordion-menu-jquery.html" title="Create Simplest Accordion Menu using jQuery">Create Simplest Accordion Menu using jQuery</a></li><li><a href="http://viralpatel.net/blogs/2009/08/20-top-jquery-tips-tricks-for-jquery-programmers.html" title="20 Top jQuery Tips &#038; Tricks for jQuery Programmers">20 Top jQuery Tips &#038; Tricks for jQuery Programmers</a></li><li><a href="http://viralpatel.net/blogs/2009/06/textarea-resize-javascript-jquery-plugin-resize-textarea-html.html" title="Textarea Resize JavaScript: Resize textarea using jQuery plugin">Textarea Resize JavaScript: Resize textarea using jQuery plugin</a></li></ul></div>]]></content:encoded> <wfw:commentRss>http://viralpatel.net/blogs/2011/02/jquery-get-text-element-without-child-element.html/feed</wfw:commentRss> <slash:comments>4</slash:comments> </item> <item><title>Dynamically shortened Text with &#8220;Show More&#8221; link using jQuery</title><link>http://viralpatel.net/blogs/2010/12/dynamically-shortened-text-show-more-link-jquery.html</link> <comments>http://viralpatel.net/blogs/2010/12/dynamically-shortened-text-show-more-link-jquery.html#comments</comments> <pubDate>Tue, 28 Dec 2010 12:40:07 +0000</pubDate> <dc:creator>Viral Patel</dc:creator> <category><![CDATA[CSS]]></category> <category><![CDATA[JavaScript]]></category> <category><![CDATA[JQuery]]></category> <category><![CDATA[How-To]]></category><guid isPermaLink="false">http://viralpatel.net/blogs/?p=2126</guid> <description><![CDATA[Facebook user updates has a great functionality. If the comment text is larger than few characters, the extra words are hide and a show more link is presented to user. This way you can keep long text out of the view to user and stop the cluttering of page. Also interested users can click on [...]]]></description> <content:encoded><![CDATA[<p><img src="http://img.viralpatel.net/2010/12/show-more-link.png" alt="" title="show-more-link" width="341" height="82" class="aligncenter size-full wp-image-2127" /><br /> Facebook user updates has a great functionality. If the comment text is larger than few characters, the extra words are hide and a show more link is presented to user. This way you can keep long text out of the view to user and stop the cluttering of page. Also interested users can click on <em>more</em> link and see the full content.</p><p>Here is a simple tutorial to achieve this using jQuery / Javascript.</p><h2>The HTML</h2><p>Below is the sample text. Each text is wrapped in a DIV tag. Note that we have added a class &#8220;more&#8221; in each div. This class will decide if a text needs to be shortened and show more link showed or not.</p><pre class="brush: xml; title: ; notranslate">
&lt;div class=&quot;comment more&quot;&gt;
	Lorem ipsum dolor sit amet, consectetur adipiscing elit.
	Vestibulum laoreet, nunc eget laoreet sagittis,
	quam ligula sodales orci, congue imperdiet eros tortor ac lectus.
	Duis eget nisl orci. Aliquam mattis purus non mauris
	blandit id luctus felis convallis.
	Integer varius egestas vestibulum.
	Nullam a dolor arcu, ac tempor elit. Donec.
&lt;/div&gt;
&lt;div class=&quot;comment more&quot;&gt;
	Duis nisl nibh, egestas at fermentum at, viverra et purus.
	Maecenas lobortis odio id sapien facilisis elementum.
	Curabitur et magna justo, et gravida augue.
	Sed tristique pellentesque arcu quis tempor.
&lt;/div&gt;
&lt;div class=&quot;comment more&quot;&gt;
	consectetur adipiscing elit. Proin blandit nunc sed sem dictum id feugiat quam blandit.
	Donec nec sem sed arcu interdum commodo ac ac diam. Donec consequat semper rutrum.
	Vestibulum et mauris elit. Vestibulum mauris lacus, ultricies.
&lt;/div&gt;
</pre><h2>The CSS</h2><p>Below is the CSS code for our example. Note the class &#8220;.morecontent span&#8221; is hidden. The extra text from the content is wrapped in this span and is hidden at time of page loading.</p><pre class="brush: css; title: ; notranslate">
a {
	color: #0254EB
}
a:visited {
	color: #0254EB
}
a.morelink {
	text-decoration:none;
	outline: none;
}
.morecontent span {
	display: none;
}
.comment {
	width: 400px;
	background-color: #f0f0f0;
	margin: 10px;
}
</pre><h2>The Javascript</h2><p>Below is the Javascript code which iterate through each DIV tags with class &#8220;more&#8221; and split the text in two. First half is showed to user and second is made hidden with a link &#8220;more..&#8221;.</p><p>You can change the behaviour by changing following js variables.</p><ul><li><em>showChar</em>: Total characters to show to user. If the content is more then showChar, it will be split into two halves and first one will be showed to user.</li><li><em>ellipsestext</em>: The text displayed before &#8220;more&#8221; link. Default is &#8220;&#8230;&#8221;</li><li><em>moretext</em>: The text shown in more link. Default is &#8220;more&#8221;. You can change to &#8220;>>&#8221;</li><li><em>lesstext</em>: The text shown in less link. Default is &#8220;less&#8221;. You can change to &#8220;<<"</li></ul><pre class="brush: jscript; title: ; notranslate">
$(document).ready(function() {
	var showChar = 100;
	var ellipsestext = &quot;...&quot;;
	var moretext = &quot;more&quot;;
	var lesstext = &quot;less&quot;;
	$('.more').each(function() {
		var content = $(this).html();

		if(content.length &gt; showChar) {

			var c = content.substr(0, showChar);
			var h = content.substr(showChar-1, content.length - showChar);

			var html = c + '&lt;span class=&quot;moreellipses&quot;&gt;' + ellipsestext+ '&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;morecontent&quot;&gt;&lt;span&gt;' + h + '&lt;/span&gt;&amp;nbsp;&amp;nbsp;&lt;a href=&quot;&quot; class=&quot;morelink&quot;&gt;' + moretext + '&lt;/a&gt;&lt;/span&gt;';

			$(this).html(html);
		}

	});

	$(&quot;.morelink&quot;).click(function(){
		if($(this).hasClass(&quot;less&quot;)) {
			$(this).removeClass(&quot;less&quot;);
			$(this).html(moretext);
		} else {
			$(this).addClass(&quot;less&quot;);
			$(this).html(lesstext);
		}
		$(this).parent().prev().toggle();
		$(this).prev().toggle();
		return false;
	});
});
</pre><h2>Online Demo</h2><p><a target="_blank" href="http://viralpatel.net/blogs/demo/jquery/show-more-link-shortened-content/">Click here to view demo</a><br /> <iframe src="http://viralpatel.net/blogs/demo/jquery/show-more-link-shortened-content/demo.html" width="100%" height="200px" ></iframe></p><h2>Download Source Code</h2><p><a href="http://viralpatel.net/blogs/demo/jquery/show-more-link-shortened-content/download.zip">Click here to download (ZIP, 2KB)</a></p><p><strong>Update:</strong><br /> The above code is modified into jQuery plugin. Thanks to Jay. Following is the code.</p><h2>jQuery Plugin</h2><h3>Code</h3><pre class="brush: jscript; title: ; notranslate">
jQuery.fn.shorten = function(settings) {
  var config = {
    showChars : 100,
    ellipsesText : &quot;...&quot;,
    moreText : &quot;more&quot;,
    lessText : &quot;less&quot;
  };

  if (settings) {
    $.extend(config, settings);
  }

  $('.morelink').live('click', function() {
    var $this = $(this);
    if ($this.hasClass('less')) {
      $this.removeClass('less');
      $this.html(config.moreText);
    } else {
      $this.addClass('less');
      $this.html(config.lessText);
    }
    $this.parent().prev().toggle();
    $this.prev().toggle();
    return false;
  });

  return this.each(function() {
    var $this = $(this);

    var content = $this.html();
    if (content.length &gt; config.showChars) {
      var c = content.substr(0, config.showChars);
      var h = content.substr(config.showChars , content.length - config.showChars);
      var html = c + '&lt;span class=&quot;moreellipses&quot;&gt;' + config.ellipsesText + '&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;morecontent&quot;&gt;&lt;span&gt;' + h + '&lt;/span&gt;&amp;nbsp;&amp;nbsp;&lt;a href=&quot;javascript://nop/&quot; class=&quot;morelink&quot;&gt;' + config.moreText + '&lt;/a&gt;&lt;/span&gt;';
      $this.html(html);
      $(&quot;.morecontent span&quot;).hide();
    }
  });
}</pre><h3>Download</h3><p><a target="_blank" href="http://viralpatel.net/blogs/demo/jquery/jquery.shorten.1.0.js">Click to login jQuery Shorten plugin</a></p><h3>Usage</h3><p><strong>Step 1:</strong> Include the jQuery plugin in your HTML</p><pre class="brush: xml; title: ; notranslate">
&lt;script type=&quot;text/javascript&quot;
	src=&quot;http://viralpatel.net/blogs/demo/jquery/jquery.shorten.1.0.js&quot;&gt;&lt;/script&gt;
</pre><p><strong>Step 2:</strong> Add the code to shorten any DIV content. In below example we are shortening DIV with class &#8220;comment&#8221;.</p><pre class="brush: xml; title: ; notranslate">
&lt;div class=&quot;comment&quot;&gt;
	This is a long comment text.
	This is a long comment text.
	This is a long comment text.
	This is a long comment text. This is a long comment text.
&lt;/div&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
	$(document).ready(function() {

		$(&quot;.comment&quot;).shorten();

	});
&lt;/script&gt;
</pre><p>You may want to pass the parameters to shorten() method and override the default ones.</p><pre class="brush: jscript; title: ; notranslate">
$(&quot;.comment&quot;).shorten({
	&quot;showChars&quot; : 200
});

$(&quot;.comment&quot;).shorten({
	&quot;showChars&quot; : 150,
	&quot;moreText&quot;	: &quot;See More&quot;,
});

$(&quot;.comment&quot;).shorten({
	&quot;showChars&quot; : 50,
	&quot;moreText&quot;	: &quot;See More&quot;,
	&quot;lessText&quot;	: &quot;Less&quot;,
});
</pre><div id="relatedpost"><h2  class="related_post_title">Related Posts</h2><ul class="related_post"><li><a href="http://viralpatel.net/blogs/2011/02/jquery-get-text-element-without-child-element.html" title="jQuery: Get the Text of Element without Child Element">jQuery: Get the Text of Element without Child Element</a></li><li><a href="http://viralpatel.net/blogs/2010/11/multiple-checkbox-select-deselect-jquery-tutorial-example.html" title="Multiple Checkbox Select/Deselect using jQuery &#8211; Tutorial with Example">Multiple Checkbox Select/Deselect using jQuery &#8211; Tutorial with Example</a></li><li><a href="http://viralpatel.net/blogs/2010/01/jquery-resizable-draggable-resize-drag-tutorial-example.html" title="jQuery Resizable and Draggable Tutorial with Example">jQuery Resizable and Draggable Tutorial with Example</a></li><li><a href="http://viralpatel.net/blogs/2009/09/change-form-input-textbox-style-focus-jquery.html" title="Changing Form Input (Textbox) Style on Focus using jQuery">Changing Form Input (Textbox) Style on Focus using jQuery</a></li><li><a href="http://viralpatel.net/blogs/2009/01/fadein-fadeout-fade-out-effect-in-html-text-div-using-jquery.html" title="FadeIn FadeOut html text div effect using jQuery.">FadeIn FadeOut html text div effect using jQuery.</a></li><li><a href="http://viralpatel.net/blogs/2008/12/creating-orkut-style-status-update-div-textbox-using-jquery.html" title="Creating orkut style status update div-textbox using jQuery.">Creating orkut style status update div-textbox using jQuery.</a></li><li><a href="http://viralpatel.net/blogs/2008/11/textbox-with-background-image-using-css.html" title="Textbox with background image using CSS">Textbox with background image using CSS</a></li></ul></div>]]></content:encoded> <wfw:commentRss>http://viralpatel.net/blogs/2010/12/dynamically-shortened-text-show-more-link-jquery.html/feed</wfw:commentRss> <slash:comments>16</slash:comments> </item> <item><title>jQuery Ajax &#8211; Handling unauthenticated requests via Ajax</title><link>http://viralpatel.net/blogs/2010/12/jquery-ajax-handling-unauthenticated-request-ajax.html</link> <comments>http://viralpatel.net/blogs/2010/12/jquery-ajax-handling-unauthenticated-request-ajax.html#comments</comments> <pubDate>Fri, 24 Dec 2010 10:12:54 +0000</pubDate> <dc:creator>Viral Patel</dc:creator> <category><![CDATA[AJAX]]></category> <category><![CDATA[JavaScript]]></category> <category><![CDATA[JQuery]]></category> <category><![CDATA[authentication]]></category> <category><![CDATA[http error]]></category> <category><![CDATA[jquery ajax tutorial]]></category><guid isPermaLink="false">http://viralpatel.net/blogs/?p=2118</guid> <description><![CDATA[Since few days I am working on a small project where I have to deal with lot of Ajax requests. The whole UI is designed such that only appropriate parts are refreshed with required information through Ajax. The application needs user authentication before accessing any part of it. Although this is easy to achieve in [...]]]></description> <content:encoded><![CDATA[<p><img src="http://img.viralpatel.net/2010/12/security_lock.png" alt="" title="security_lock" width="208" height="153" class="alignright size-full wp-image-2119" />Since few days I am working on a small project where I have to deal with lot of Ajax requests. The whole UI is designed such that only appropriate parts are refreshed with required information through Ajax.</p><p>The application needs user authentication before accessing any part of it. Although this is easy to achieve in any MVC based framework, its a whole new thing when dealing with Ajax requests.</p><p>In a normal request/response based MVC application, if a user is not authenticated and tries to view a webpage, the request is redirected to the Login page. Almost all MVC framework comes with this functionality. When the request gets redirected to Login page, the Status Code 403 (Forbidden) is set in HTTP header. 403 Forbidden is a HTTP status code returned by a web server when a user agent requests a resource that the server does not allow them to.</p><p>But when using Ajax for getting the content, if the request is redirected to Login page, it is difficult to handle this scenario.</p><p>Here is a simplest solution that can be implemented in your Ajax based application. Just add this code in your Javascript file.</p><pre class="brush: jscript; title: ; notranslate">
    $(document).ready(
        function() {
            $(&quot;body&quot;).ajaxError(
                function(e,request) {
                    if (request.status == 403) {
                        window.location.reload();
                        //window.location.href = &quot;/myapp/login&quot;;
                    }
                }
            );
        }
    );
</pre><p>In above code, we have added a handler function to ajaxError which gets called by jQuery whenever there is an error in the HTTP Response. The function checks if the status code is 403, if it is then it simply tries to reload the URL. This generate a new request to the server which automatically gets redirected to the login page. The only disadvantage of reloading the page is that you generate a new HTTP request which server has to handle and redirect to Login page.</p><p>You may wish to directly redirect user to login page from client code itself. Check the Line XX where we are changing the windows location and redirecting user. I personally dont like this method as you have to hard code the path for login page in javascript. I prefer using the previous solution to reload the page.</p><p>I am sure there must be several way of implementing this in Javascript. Share yours if you think you have a better one <img src='http://viralpatel.net/blogs/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p><div id="relatedpost"><h2  class="related_post_title">Related Posts</h2><ul class="related_post"><li><a href="http://viralpatel.net/blogs/2009/04/jquery-ajax-tutorial-example-ajax-jquery-development.html" title="jQuery AJAX Tutorial, Example: Simplify Ajax development with jQuery">jQuery AJAX Tutorial, Example: Simplify Ajax development with jQuery</a></li><li><a href="http://viralpatel.net/blogs/2009/02/handling-session-timeout-server-errors-http-ajax-session-ajax-session-timeout-problem.html" title="Handling Session timeout &#038; other server http errors in AJAX">Handling Session timeout &#038; other server http errors in AJAX</a></li><li><a href="http://viralpatel.net/blogs/2008/12/ajax-post-method-example-using-javascript-jquery.html" title="AJAX Post Method example using Javascript &#038; jQuery">AJAX Post Method example using Javascript &#038; jQuery</a></li><li><a href="http://viralpatel.net/blogs/2012/01/scroll-fix-header-jquery-facebook.html" title="Facebook Style Scroll Fixed Header in JQuery">Facebook Style Scroll Fixed Header in JQuery</a></li><li><a href="http://viralpatel.net/blogs/2011/02/clearable-textbox-jquery.html" title="Create a Clearable TextBox with jQuery">Create a Clearable TextBox with jQuery</a></li><li><a href="http://viralpatel.net/blogs/2011/02/jquery-get-text-element-without-child-element.html" title="jQuery: Get the Text of Element without Child Element">jQuery: Get the Text of Element without Child Element</a></li><li><a href="http://viralpatel.net/blogs/2011/01/first-play-framework-gae-siena-application-tutorial-example.html" title="Your first Play! &#8211; GAE &#8211; Siena application: Tutorial with Example">Your first Play! &#8211; GAE &#8211; Siena application: Tutorial with Example</a></li></ul></div>]]></content:encoded> <wfw:commentRss>http://viralpatel.net/blogs/2010/12/jquery-ajax-handling-unauthenticated-request-ajax.html/feed</wfw:commentRss> <slash:comments>1</slash:comments> </item> <item><title>Multiple Checkbox Select/Deselect using jQuery &#8211; Tutorial with Example</title><link>http://viralpatel.net/blogs/2010/11/multiple-checkbox-select-deselect-jquery-tutorial-example.html</link> <comments>http://viralpatel.net/blogs/2010/11/multiple-checkbox-select-deselect-jquery-tutorial-example.html#comments</comments> <pubDate>Thu, 11 Nov 2010 07:08:34 +0000</pubDate> <dc:creator>Viral Patel</dc:creator> <category><![CDATA[JavaScript]]></category> <category><![CDATA[JQuery]]></category> <category><![CDATA[How-To]]></category> <category><![CDATA[jquery tips tricks]]></category><guid isPermaLink="false">http://viralpatel.net/blogs/?p=2113</guid> <description><![CDATA[Almost all the user interfaces that I have created had this functionality of selecting multiple items from a list to process them or delete them. Although its very very easy to implement this functionality in Javascript, using jQuery for this is real fun. I will show you a simple implementation of adding multiple checkbox select [...]]]></description> <content:encoded><![CDATA[<p><img src="http://img.viralpatel.net/2010/11/multiple-checkbox-select-jqeury.jpg" alt="multiple-checkbox-select-jquery" title="multiple-checkbox-select-jquery" width="177" height="225" class="alignleft size-full wp-image-2114" />Almost all the user interfaces that I have created had this functionality of selecting multiple items from a list to process them or delete them. Although its very very easy to implement this functionality in Javascript, using jQuery for this is real fun. I will show you a simple implementation of adding multiple checkbox select and deselect functionality to any webpage. We will have a table with some data in it and checkbox in each row. There will be a select all checkbox in the header of the table. If user select/deselect the selectall checkbox, all the checkbox in table will get selected or deselected accordingly. Now one more thing we would like here to add is, suppose user select all the checkbox one by one then the selectall checkbox should be automatically gets selected. And if user click selectall first and then unchecks any of the checkbox, then the selectall also should be unchecked automatically.</p><h2>The HTML</h2><pre class="brush: xml; title: ; notranslate">
&lt;HTML&gt;
&lt;HEAD&gt;
	&lt;script type=&quot;text/javascript&quot; src=&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js&quot;&gt;&lt;/script&gt;
	&lt;TITLE&gt;Multiple Checkbox Select/Deselect - DEMO&lt;/TITLE&gt;
&lt;/HEAD&gt;
&lt;BODY&gt;
	&lt;H2&gt;Multiple Checkbox Select/Deselect - DEMO&lt;/H2&gt;
&lt;table border=&quot;1&quot;&gt;
&lt;tr&gt;
	&lt;th&gt;&lt;input type=&quot;checkbox&quot; id=&quot;selectall&quot;/&gt;&lt;/th&gt;
	&lt;th&gt;Cell phone&lt;/th&gt;
	&lt;th&gt;Rating&lt;/th&gt;
&lt;/tr&gt;
&lt;tr&gt;
	&lt;td align=&quot;center&quot;&gt;&lt;input type=&quot;checkbox&quot; class=&quot;case&quot; name=&quot;case&quot; value=&quot;1&quot;/&gt;&lt;/td&gt;
	&lt;td&gt;BlackBerry Bold 9650&lt;/td&gt;
	&lt;td&gt;2/5&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
	&lt;td align=&quot;center&quot;&gt;&lt;input type=&quot;checkbox&quot; class=&quot;case&quot; name=&quot;case&quot; value=&quot;2&quot;/&gt;&lt;/td&gt;
	&lt;td&gt;Samsung Galaxy&lt;/td&gt;
	&lt;td&gt;3.5/5&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
	&lt;td align=&quot;center&quot;&gt;&lt;input type=&quot;checkbox&quot; class=&quot;case&quot; name=&quot;case&quot; value=&quot;3&quot;/&gt;&lt;/td&gt;
	&lt;td&gt;Droid X&lt;/td&gt;
	&lt;td&gt;4.5/5&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
	&lt;td align=&quot;center&quot;&gt;&lt;input type=&quot;checkbox&quot; class=&quot;case&quot; name=&quot;case&quot; value=&quot;4&quot;/&gt;&lt;/td&gt;
	&lt;td&gt;HTC Desire&lt;/td&gt;
	&lt;td&gt;3/5&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
	&lt;td align=&quot;center&quot;&gt;&lt;input type=&quot;checkbox&quot; class=&quot;case&quot; name=&quot;case&quot; value=&quot;5&quot;/&gt;&lt;/td&gt;
	&lt;td&gt;Apple iPhone 4&lt;/td&gt;
	&lt;td&gt;5/5&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;

&lt;/BODY&gt;
&lt;/HTML&gt;
</pre><h2>The jQuery Code</h2><p>Add following jQuery code in HEAD section of above HTML</p><pre class="brush: jscript; title: ; notranslate">
&lt;SCRIPT language=&quot;javascript&quot;&gt;
$(function(){

	// add multiple select / deselect functionality
	$(&quot;#selectall&quot;).click(function () {
		  $('.case').attr('checked', this.checked);
	});

	// if all checkbox are selected, check the selectall checkbox
	// and viceversa
	$(&quot;.case&quot;).click(function(){

		if($(&quot;.case&quot;).length == $(&quot;.case:checked&quot;).length) {
			$(&quot;#selectall&quot;).attr(&quot;checked&quot;, &quot;checked&quot;);
		} else {
			$(&quot;#selectall&quot;).removeAttr(&quot;checked&quot;);
		}

	});
});
&lt;/SCRIPT&gt;
</pre><p>Here in above code at line 05, we register a handler on click of selectall checkbox. On click of this checkbox, we check/uncheck all checkbox in the datatable.<br /> Also check the link 13, where we check the selectall checkbox, if all the checkbox are selected manually. To get more idea, play with the below demo.</p><h2>Online Demo</h2><p><iframe src="http://viralpatel.net/blogs/demo/jquery/multiple-checkbox-select-deselect/demo-article.html" width="100%" height="180px"></iframe></p><p><a href="http://viralpatel.net/blogs/demo/jquery/multiple-checkbox-select-deselect/jquery-select-multiple-checkbox.html">Click here to view Online Demo</a></p><div id="relatedpost"><h2  class="related_post_title">Related Posts</h2><ul class="related_post"><li><a href="http://viralpatel.net/blogs/2011/02/jquery-get-text-element-without-child-element.html" title="jQuery: Get the Text of Element without Child Element">jQuery: Get the Text of Element without Child Element</a></li><li><a href="http://viralpatel.net/blogs/2008/12/creating-orkut-style-status-update-div-textbox-using-jquery.html" title="Creating orkut style status update div-textbox using jQuery.">Creating orkut style status update div-textbox using jQuery.</a></li><li><a href="http://viralpatel.net/blogs/2011/02/clearable-textbox-jquery.html" title="Create a Clearable TextBox with jQuery">Create a Clearable TextBox with jQuery</a></li><li><a href="http://viralpatel.net/blogs/2010/12/dynamically-shortened-text-show-more-link-jquery.html" title="Dynamically shortened Text with &#8220;Show More&#8221; link using jQuery">Dynamically shortened Text with &#8220;Show More&#8221; link using jQuery</a></li><li><a href="http://viralpatel.net/blogs/2010/01/javascript-array-remove-element-js-array-delete-element.html" title="JavaScript Array Remove an Element ">JavaScript Array Remove an Element </a></li><li><a href="http://viralpatel.net/blogs/2010/01/jquery-resizable-draggable-resize-drag-tutorial-example.html" title="jQuery Resizable and Draggable Tutorial with Example">jQuery Resizable and Draggable Tutorial with Example</a></li><li><a href="http://viralpatel.net/blogs/2009/09/default-text-label-textbox-javascript-jquery.html" title="Default Text Label in Textbox using JavaScript/jQuery">Default Text Label in Textbox using JavaScript/jQuery</a></li></ul></div>]]></content:encoded> <wfw:commentRss>http://viralpatel.net/blogs/2010/11/multiple-checkbox-select-deselect-jquery-tutorial-example.html/feed</wfw:commentRss> <slash:comments>19</slash:comments> </item> <item><title>Understanding jQuery animate() function</title><link>http://viralpatel.net/blogs/2010/03/understanding-jquery-animate-function.html</link> <comments>http://viralpatel.net/blogs/2010/03/understanding-jquery-animate-function.html#comments</comments> <pubDate>Tue, 09 Mar 2010 12:38:15 +0000</pubDate> <dc:creator>Viral Patel</dc:creator> <category><![CDATA[JavaScript]]></category> <category><![CDATA[JQuery]]></category> <category><![CDATA[jQuery Effects]]></category><guid isPermaLink="false">http://viralpatel.net/blogs/?p=2045</guid> <description><![CDATA[jQuery animate() function is very powerful API to manipulate html elements and add animation functionality. The use of animate function is very simple. First lets check the syntax of this function. .animate( properties, [ duration ], [ easing ], [ callback ] ) properties: A map of CSS properties that the animation will move toward. [...]]]></description> <content:encoded><![CDATA[<p><img src="http://img.viralpatel.net/jquery-logo.png" alt="" title="jquery-logo" width="236" height="85" class="alignright size-full wp-image-1108" />jQuery animate() function is very powerful API to manipulate html elements and add animation functionality. The use of animate function is very simple. First lets check the syntax of this function.</p><p><strong>.animate( properties, [ duration ], [ easing ], [ callback ] )</strong></p><ul><li>properties: A map of CSS properties that the animation will move toward.</li><li>duration: A string or number determining how long the animation will run.</li><li>easing: A string indicating which easing function to use for the transition.</li><li>callback: A function to call once the animation is complete.</li></ul><p><strong>.animate( properties, options )</strong></p><ul><li>properties: A map of CSS properties that the animation will move toward.</li><li>options: A map of additional options to pass to the method. Supported keys:<ul><li>duration: A string or number determining how long the animation will run.</li><li>easing: A string indicating which easing function to use for the transition.</li><li>complete: A function to call once the animation is complete.</li><li>step: A function to be called after each step of the animation.</li><li>queue: A Boolean indicating whether to place the animation in the effects queue. If false, the animation will begin immediately.</li><li>specialEasing: A map of one or more of the CSS properties defined by the properties argument and their corresponding easing functions (added 1.4).</li></ul></li></ul><p>Lets learn the animate() function with set of examples.</p><p>First include the jQuery javascript library in your html file. Add following in your html &lt;HEAD&gt; tag:</p><pre class="brush: xml; title: ; notranslate">
&lt;SCRIPT type=&quot;text/javascript&quot;
		src=&quot;http://code.jquery.com/jquery-latest.js&quot;&gt;&lt;/SCRIPT&gt;
</pre><p>For all the demos, we will use a sample DIV tag for animating. Following is the div code and its stylesheet.</p><pre class="brush: xml; title: ; notranslate">
&lt;style type=&quot;text/css&quot;&gt;
#content {
	background-color:#ffaa00;
	width:300px;
	height:30px;
	padding:3px;
}
&lt;/style&gt;
&lt;input type=&quot;button&quot; id=&quot;animate&quot; value=&quot;Animate&quot;/&gt;
&lt;div id=&quot;content&quot;&gt;Animate Height&lt;/div&gt;
</pre><h2>Animate height/width</h2><p>Animating height and width in jQuery is very easy. Lets assume you have a DIV that you want to animate i.e. increase the height.</p><pre class="brush: jscript; title: ; notranslate">
$(&quot;#animate&quot;).click(function() {
	$(&quot;#content&quot;).animate(
			{&quot;height&quot;: &quot;80px&quot;},
			&quot;fast&quot;);
});
</pre><p><strong>Demo 1:</strong><br /> <iframe src="http://viralpatel.net/blogs/demo/jquery/animate-demo/animate-height.html" width="100%" height="150px" frameborder="0"></iframe></p><p>Also following will be the code to animate Width of the element.</p><pre class="brush: jscript; title: ; notranslate">
$(&quot;#animate&quot;).click(function() {
	$(&quot;#content&quot;).animate(
			{&quot;width&quot;: &quot;350px&quot;},
			&quot;fast&quot;);
});
</pre><p><strong>Demo 2:</strong><br /> <iframe src="http://viralpatel.net/blogs/demo/jquery/animate-demo/animate-width.html" width="100%" height="120px" frameborder="0"></iframe></p><h2>Animate opacity</h2><pre class="brush: jscript; title: ; notranslate">
$(&quot;#animate&quot;).click(function() {
	$(&quot;#content&quot;).animate(
			{&quot;opacity&quot;: &quot;0.15&quot;},
			&quot;slow&quot;);
});
</pre><p><strong>Demo 3:</strong><br /> <iframe src="http://viralpatel.net/blogs/demo/jquery/animate-demo/animate-opacity.html" width="100%" height="120px" frameborder="0"></iframe></p><h2>Moving elements using animate()</h2><pre class="brush: xml; title: ; notranslate">
&lt;STYLE&gt;
#content {
	background-color:#6688ff;
	position:absolute;
	width:100px;
	height:100px;
	padding:3px;
	margin-top:5px;
	left: 100px;
}
&lt;/STYLE&gt;
&lt;input type=&quot;button&quot; id=&quot;left&quot; value=&quot;Left&quot;/&gt;
&lt;input type=&quot;button&quot; id=&quot;right&quot; value=&quot;Right&quot;/&gt;
&lt;div id=&quot;content&quot;&gt;Move&lt;/div&gt;
</pre><pre class="brush: jscript; title: ; notranslate">
$(&quot;#right&quot;).click(function() {
	$(&quot;#content&quot;).animate(
			{&quot;left&quot;: &quot;+=50px&quot;},
			&quot;slow&quot;);
});
$(&quot;#left&quot;).click(function() {
	$(&quot;#content&quot;).animate(
			{&quot;left&quot;: &quot;-=50px&quot;},
			&quot;slow&quot;);
});
</pre><p><strong>Demo 4:</strong><br /> <iframe src="http://viralpatel.net/blogs/demo/jquery/animate-demo/animate-move.html" width="100%" height="150px" frameborder="0"></iframe></p><h2>Callback Function</h2><p>Callback functions are very useful to perform certain activity when the animation is completed. Also note here when multiple elements are mapped with the animation and we have specified a callback function. Then the callback will get called for each of the element.</p><p>Let us see an example where we use callback function to display a message when animation is completed.</p><pre class="brush: jscript; title: ; notranslate">
$(&quot;#animate&quot;).click(function() {
	$(&quot;#content&quot;).animate(
			{&quot;height&quot;: &quot;100px&quot;, &quot;width&quot;: &quot;250px&quot;},
			&quot;slow&quot;, function(){
				$(this).html(&quot;Animation Completed&quot;);
			});
});</pre><p><strong>Demo 5:</strong><br /> <iframe src="http://viralpatel.net/blogs/demo/jquery/animate-demo/animate-callback.html" width="100%" height="150px" frameborder="0"></iframe></p><h2>Combine multiple animations</h2><p>You may want to combine multiple animations. Following are few demos will help you understanding this.</p><p><strong>Example 1</strong>: Animate both height and width at same time.<br /> This example is pretty straight forward. You can animate both height and width at same time by specifying it in animate function. For example: In below code we specified height and width value in animate function.</p><pre class="brush: jscript; title: ; notranslate">
$(&quot;#animate&quot;).click(function() {
	$(&quot;#content&quot;).animate(
			{&quot;height&quot;: &quot;100px&quot;, &quot;width&quot;: &quot;250px&quot;},
			&quot;slow&quot;, );
});</pre><p><strong>Example 2</strong>: Queuing the animations.</p><pre class="brush: jscript; title: ; notranslate">
$(&quot;#animate&quot;).click(function() {
	$(&quot;#content&quot;)
		.animate({&quot;height&quot;: &quot;100px&quot;}, 500)
		.animate({&quot;width&quot;: &quot;250px&quot;}, 500);
});
</pre><p><strong>Demo 6:</strong><br /> <iframe src="http://viralpatel.net/blogs/demo/jquery/animate-demo/animate-queue.html" width="100%" height="150px" frameborder="0"></iframe></p><h2>Queuing of Events</h2><p>In above demo (Demo 6) we saw that when we queued up the events with multiple .animate() method call, the animation is actually queued up. i.e. it completes the first animation and then proceed with next. Let see an example were we use <code>queue</code> parameter to disable queuing. In following example we have set parameter <code>queue</code> to <code>false</code>. The code is exactly same as demo 6, only change we added is queue = false. Also note that queue parameter is added with second argument.</p><pre class="brush: jscript; title: ; notranslate">
$(&quot;#animate&quot;).click(function() {
	$(&quot;#content&quot;)
		.animate({&quot;height&quot;: &quot;100px&quot;}, {&quot;queue&quot;: false, &quot;duration&quot;: 500})
		.animate({&quot;width&quot;: &quot;250px&quot;}, 500);
});
</pre><p><strong>Demo 7:</strong><br /> <iframe src="http://viralpatel.net/blogs/demo/jquery/animate-demo/animate-queue-false.html" width="100%" height="150px" frameborder="0"></iframe></p><div id="relatedpost"><h2  class="related_post_title">Related Posts</h2><ul class="related_post"><li><a href="http://viralpatel.net/blogs/2009/10/jquery-bounce-effect-bounce-html-js.html" title="Fantastic Bouncy Effect using jQuery/JavaScript">Fantastic Bouncy Effect using jQuery/JavaScript</a></li><li><a href="http://viralpatel.net/blogs/2009/09/create-accordion-menu-jquery.html" title="Create Simplest Accordion Menu using jQuery">Create Simplest Accordion Menu using jQuery</a></li><li><a href="http://viralpatel.net/blogs/2009/08/20-top-jquery-tips-tricks-for-jquery-programmers.html" title="20 Top jQuery Tips &#038; Tricks for jQuery Programmers">20 Top jQuery Tips &#038; Tricks for jQuery Programmers</a></li><li><a href="http://viralpatel.net/blogs/2009/07/delete-row-html-table-clicking-using-jquery.html" title="Delete Row from HTML Table by clicking it using jQuery">Delete Row from HTML Table by clicking it using jQuery</a></li><li><a href="http://viralpatel.net/blogs/2009/03/how-to-apply-html-user-interface-effects-using-jquery.html" title="How to apply HTML User Interface Effects using jQuery.">How to apply HTML User Interface Effects using jQuery.</a></li><li><a href="http://viralpatel.net/blogs/2012/01/scroll-fix-header-jquery-facebook.html" title="Facebook Style Scroll Fixed Header in JQuery">Facebook Style Scroll Fixed Header in JQuery</a></li><li><a href="http://viralpatel.net/blogs/2011/02/clearable-textbox-jquery.html" title="Create a Clearable TextBox with jQuery">Create a Clearable TextBox with jQuery</a></li></ul></div>]]></content:encoded> <wfw:commentRss>http://viralpatel.net/blogs/2010/03/understanding-jquery-animate-function.html/feed</wfw:commentRss> <slash:comments>16</slash:comments> </item> <item><title>JavaScript Array Remove an Element</title><link>http://viralpatel.net/blogs/2010/01/javascript-array-remove-element-js-array-delete-element.html</link> <comments>http://viralpatel.net/blogs/2010/01/javascript-array-remove-element-js-array-delete-element.html#comments</comments> <pubDate>Wed, 27 Jan 2010 09:59:50 +0000</pubDate> <dc:creator>Viral Patel</dc:creator> <category><![CDATA[JavaScript]]></category> <category><![CDATA[How-To]]></category><guid isPermaLink="false">http://viralpatel.net/blogs/?p=2007</guid> <description><![CDATA[Following is an example of JavaScript where we will remove elements from an array with Index and Value. There are different methods in JavaScript that we can use to remove elements. We will use splice() method. Remove Array element by Index First we will see an example were we will remove array element by its [...]]]></description> <content:encoded><![CDATA[<p>Following is an example of JavaScript where we will remove elements from an array with Index and Value. There are different methods in JavaScript that we can use to remove elements. We will use <code>splice()</code> method.</p><h2>Remove Array element by Index</h2><p>First we will see an example were we will remove array element by its index. For this we can define a generic function <strong>removeByIndex()</strong>.</p><pre class="brush: jscript; title: ; notranslate">
function removeByIndex(arr, index) {
	arr.splice(index, 1);
}
</pre><p>In above code we used javascript <code>splice()</code> method to remove element at an index. splice() method takes two argument. First is the index at which you want to remove element and second is number of elements to be removed. In our case it is 1.<br /> <img src="http://img.viralpatel.net/2010/01/javascript-array-remove-element.png" alt="javascript-array-remove-element" title="javascript-array-remove-element" width="334" height="246" class="aligncenter size-full wp-image-2008" /><br /> To test the above code lets define a simple array and remove one of the element.</p><pre class="brush: jscript; title: ; notranslate">
test = new Array();
test[0] = 'Apple';
test[1] = 'Ball';
test[2] = 'Cat';
test[3] = 'Dog';
alert(&quot;Array before removing elements: &quot;+test);
removeByIndex(test, 2);
alert(&quot;Array after removing elements: &quot;+test);
</pre><p>Also you may want to define removeByIndex method with an array so that you call it directly. For example, in following example, we have define an array test and its method removeByIndex().</p><pre class="brush: jscript; title: ; notranslate">
test = new Array();
//define removeByIndex method as part of the array
Array.prototype.removeByIndex = function(index) {
	this.splice(index, 1);
}
test[0] = 'Apple';
test[1] = 'Ball';
test[2] = 'Cat';
test[3] = 'Dog';
alert(&quot;Array before removing elements: &quot;+test);
test.removeByIndex(2);
alert(&quot;Array after removing elements: &quot;+test);
</pre><h2>Remove Array element by Value</h2><p>You may want to remove array element by its value and not index. This can be easily done by iterating through it and comparing the values, if a match is found we can remove that element by <code>splice()</code> method.</p><pre class="brush: jscript; title: ; notranslate">
function removeByValue(arr, val) {
	for(var i=0; i&lt;arr.length; i++) {
		if(arr[i] == val) {
			arr.splice(i, 1);
			break;
		}
	}
}
</pre><p>The above code can be written as part of array also:</p><pre class="brush: jscript; title: ; notranslate">
test = new Array();
Array.prototype.removeByValue = function(val) {
	for(var i=0; i&lt;this.length; i++) {
		if(this[i] == val) {
			this.splice(i, 1);
			break;
		}
	}
}
test[0] = 'Apple';
test[1] = 'Ball';
test[2] = 'Cat';
test[3] = 'Dog';
alert(&quot;Array before removing elements: &quot;+test);
test.removeByValue('Cat');
alert(&quot;Array after removing elements: &quot;+test);
</pre><p>Enjoy&#8230;</p><div id="relatedpost"><h2  class="related_post_title">Related Posts</h2><ul class="related_post"><li><a href="http://viralpatel.net/blogs/2010/11/multiple-checkbox-select-deselect-jquery-tutorial-example.html" title="Multiple Checkbox Select/Deselect using jQuery &#8211; Tutorial with Example">Multiple Checkbox Select/Deselect using jQuery &#8211; Tutorial with Example</a></li><li><a href="http://viralpatel.net/blogs/2009/06/creating-dynamic-menu-planning-page-shopping-list.html" title="Creating a dynamic menu-planning page and shopping list">Creating a dynamic menu-planning page and shopping list</a></li><li><a href="http://viralpatel.net/blogs/2009/01/dynamic-add-textbox-input-button-radio-element-html-javascript.html" title="Dynamically add button, textbox, input, radio elements in html form using JavaScript.">Dynamically add button, textbox, input, radio elements in html form using JavaScript.</a></li><li><a href="http://viralpatel.net/blogs/2009/01/calling-javascript-function-from-string.html" title="Calling JavaScript function from String">Calling JavaScript function from String</a></li><li><a href="http://viralpatel.net/blogs/2008/12/increase-performance-of-website-by-compressing-javascript.html" title="Increase performance of website by compressing JavaScript.">Increase performance of website by compressing JavaScript.</a></li><li><a href="http://viralpatel.net/blogs/2008/12/how-to-capture-browser-close-button-event-or-exiting-the-page-in-javascript.html" title="How to: Capture browser close button event or exiting the page in javascript.">How to: Capture browser close button event or exiting the page in javascript.</a></li><li><a href="http://viralpatel.net/blogs/2008/12/dynamic-combobox-listbox-drop-down-using-javascript.html" title="Dynamic combobox-listbox-drop-down using javascript">Dynamic combobox-listbox-drop-down using javascript</a></li></ul></div>]]></content:encoded> <wfw:commentRss>http://viralpatel.net/blogs/2010/01/javascript-array-remove-element-js-array-delete-element.html/feed</wfw:commentRss> <slash:comments>5</slash:comments> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced

Served from: viralpatel.net @ 2012-02-09 03:27:03 -->
