<?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>{5} Setfive - Talking to the World &#187; jQuery</title>
	<atom:link href="http://shout.setfive.com/tag/jquery/feed/" rel="self" type="application/rss+xml" />
	<link>http://shout.setfive.com</link>
	<description></description>
	<lastBuildDate>Wed, 18 Jan 2012 21:09:19 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Toggle non-consecutive checkboxes with jQuery UI</title>
		<link>http://shout.setfive.com/2011/12/27/toggle-non-consecutive-checkboxes-with-jquery-ui/</link>
		<comments>http://shout.setfive.com/2011/12/27/toggle-non-consecutive-checkboxes-with-jquery-ui/#comments</comments>
		<pubDate>Tue, 27 Dec 2011 16:19:38 +0000</pubDate>
		<dc:creator>Ashish Datta</dc:creator>
				<category><![CDATA[open source]]></category>
		<category><![CDATA[forms]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://shout.setfive.com/?p=1272</guid>
		<description><![CDATA[You&#8217;re all probably familiar with the UI convention of allowing users to select ALL or NONE for a list of checkboxes (like in Gmail). Recently I was working on a project that had a large table full of checkboxes (imagine a 10&#215;10 grid) where the user would need to toggle some but not all of [...]]]></description>
			<content:encoded><![CDATA[<p>You&#8217;re all probably familiar with the UI convention of allowing users to select ALL or NONE for a list of checkboxes (like in Gmail). Recently I was working on a project that had a large table full of checkboxes (imagine a 10&#215;10 grid) where the user would need to toggle some but not all of the checkboxes in a given row. And to make matters more complex, they would need to toggle groups of non-consecutive checkboxes (say 15, skip 10, 5, etc.). I threw on the thinking cap but couldn&#8217;t think of any similar interactions I&#8217;d seen and couldn&#8217;t think of a particularly good way to achieve this.</p>
<p><strong>Enter jQuery UI</strong>. I happened to stumble across the jQuery UI Selectable documentation and realized it would provide a good UI experience to toggle some but not all of the checkboxes. The code to implement this is surprisingly simple:</p>
<p><strong>Note: You don&#8217;t actually need the div container &#8211; that was just for JSFiddle.</strong></p>
<pre name="code" class="php">
&lt;div id=&quot;checkboxes&quot;&gt;

&lt;table id=&quot;checkboxTable&quot;&gt;
     &lt;tr&gt;
         &lt;td&gt;&lt;input type=&quot;checkbox&quot; /&gt;&lt;/td&gt;
          &lt;td&gt;&lt;input type=&quot;checkbox&quot; /&gt;&lt;/td&gt;
          &lt;td&gt;&lt;input type=&quot;checkbox&quot; /&gt;&lt;/td&gt;
          &lt;td&gt;&lt;input type=&quot;checkbox&quot; /&gt;&lt;/td&gt;
     &lt;/tr&gt;
     &lt;tr&gt;
         &lt;td&gt;&lt;input type=&quot;checkbox&quot; /&gt;&lt;/td&gt;
          &lt;td&gt;&lt;input type=&quot;checkbox&quot; /&gt;&lt;/td&gt;
          &lt;td&gt;&lt;input type=&quot;checkbox&quot; /&gt;&lt;/td&gt;
          &lt;td&gt;&lt;input type=&quot;checkbox&quot; /&gt;&lt;/td&gt;
     &lt;/tr&gt;
     &lt;tr&gt;
         &lt;td&gt;&lt;input type=&quot;checkbox&quot; /&gt;&lt;/td&gt;
          &lt;td&gt;&lt;input type=&quot;checkbox&quot; /&gt;&lt;/td&gt;
          &lt;td&gt;&lt;input type=&quot;checkbox&quot; /&gt;&lt;/td&gt;
          &lt;td&gt;&lt;input type=&quot;checkbox&quot; /&gt;&lt;/td&gt;
     &lt;/tr&gt;
     &lt;tr&gt;
         &lt;td&gt;&lt;input type=&quot;checkbox&quot; /&gt;&lt;/td&gt;
          &lt;td&gt;&lt;input type=&quot;checkbox&quot; /&gt;&lt;/td&gt;
          &lt;td&gt;&lt;input type=&quot;checkbox&quot; /&gt;&lt;/td&gt;
          &lt;td&gt;&lt;input type=&quot;checkbox&quot; /&gt;&lt;/td&gt;
     &lt;/tr&gt;
     &lt;tr&gt;
         &lt;td&gt;&lt;input type=&quot;checkbox&quot; /&gt;&lt;/td&gt;
          &lt;td&gt;&lt;input type=&quot;checkbox&quot; /&gt;&lt;/td&gt;
          &lt;td&gt;&lt;input type=&quot;checkbox&quot; /&gt;&lt;/td&gt;
          &lt;td&gt;&lt;input type=&quot;checkbox&quot; /&gt;&lt;/td&gt;
     &lt;/tr&gt;
&lt;/table&gt;
&lt;/div&gt;
</pre>
<p>And then the Javascript (jQuery + jQuery UI):</p>
<pre name="code" class="php">
$("#checkboxes").selectable( {filter: "input:checkbox",
            stop: function(event, ui) {

                $(".ui-selected").each( function(){

                    $(this).each( function(){
                        var val = $(this).attr("checked") ? null : "checked";
                        $(this).attr("checked", val);
                    });

                });
}});
</pre>
<p>You can check out a live demo at <a href="http://jsfiddle.net/whMyQ/3/" target="_blank">http://jsfiddle.net/whMyQ/3/</a></p>
<p>As always, questions and comments are welcome!</p>
]]></content:encoded>
			<wfw:commentRss>http://shout.setfive.com/2011/12/27/toggle-non-consecutive-checkboxes-with-jquery-ui/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery UI confirm</title>
		<link>http://shout.setfive.com/2011/03/21/jquery-ui-confirm/</link>
		<comments>http://shout.setfive.com/2011/03/21/jquery-ui-confirm/#comments</comments>
		<pubDate>Tue, 22 Mar 2011 04:29:54 +0000</pubDate>
		<dc:creator>Ashish Datta</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[jQuery UI]]></category>

		<guid isPermaLink="false">http://shout.setfive.com/?p=577</guid>
		<description><![CDATA[I was looking around earlier for a jQuery plugin to allow me to use jQuery UI&#8217;s dialog() widget to popup a confirm dialog. Didn&#8217;t have any luck finding one so I whipped something up. It&#8217;s not pretty but it works. You could even go as far as to overload window.confirm() but thats probably a bad [...]]]></description>
			<content:encoded><![CDATA[<p>I was looking around earlier for a jQuery plugin to allow me to use jQuery UI&#8217;s dialog() widget to popup a confirm dialog. Didn&#8217;t have any luck finding one so I whipped something up. It&#8217;s not pretty but it works. You could even go as far as to overload window.confirm() but thats probably a bad idea.</p>
<pre class="php" name="code">
jQuery.confirm = function(options){

	var opts = jQuery.extend( { message: "", ok: function(){}, cancel: function(){ } }, options );

	jQuery("
<div class='span-10'>
<div class='ui-confirm-message'>"
				+ opts.message + "<img class='loader' style='padding-left: 10px' src='/images/loader.gif' />"
				+ "</div>
</div>

").dialog({
					autoOpen: true,
					modal: true,
					autoOpen: false,
					resizable: false,
					draggable: false,
					title: "",
					width: "400px",
					buttons: {
					    "Cancel": function(){
							opts.cancel.call( this );
						},
						"Ok": function(){
					    	opts.ok.call( this );
					    }
					}
	}).dialog("open");

};

// use it 

		jQuery.confirm( {
			"message": "Are you sure?",
			"ok": function( ){

				$(this).find(".loader:first").show();

				// do stuff
                               $(this).dialog("close");
			},
			"cancel": function( ){
				$(this).dialog("close");
			}
		});
</pre>
]]></content:encoded>
			<wfw:commentRss>http://shout.setfive.com/2011/03/21/jquery-ui-confirm/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>iPhone style checkboxes for Symfony</title>
		<link>http://shout.setfive.com/2010/10/13/iphone-style-checkboxes-for-symfony/</link>
		<comments>http://shout.setfive.com/2010/10/13/iphone-style-checkboxes-for-symfony/#comments</comments>
		<pubDate>Wed, 13 Oct 2010 22:46:13 +0000</pubDate>
		<dc:creator>Ashish Datta</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[symfony]]></category>

		<guid isPermaLink="false">http://shout.setfive.com/?p=412</guid>
		<description><![CDATA[No one worry, I did in fact survive my birthday and subsequent party! Anyway, I was poking around for some cool UI elements for checkboxes and stumbled across this neat jQuery plugin &#8211; http://github.com/tdreyno/iphone-style-checkboxes Basically, what it does is converts checkboxes into iPhone style toggles. Check out a demo at http://tdreyno.github.com/iphone-style-checkboxes/ This is for a [...]]]></description>
			<content:encoded><![CDATA[<p>No one worry, I did in fact survive my birthday and subsequent party!</p>
<p>Anyway, I was poking around for some cool UI elements for checkboxes and stumbled across this neat jQuery plugin &#8211; <a href="http://github.com/tdreyno/iphone-style-checkboxes" target="_blank">http://github.com/tdreyno/iphone-style-checkboxes</a> Basically, what it does is converts checkboxes into iPhone style toggles.</p>
<p>Check out a demo at <a href="http://tdreyno.github.com/iphone-style-checkboxes/" target="_blank">http://tdreyno.github.com/iphone-style-checkboxes/</a></p>
<p>This is for a symfony project (shocker!), so I figured I&#8217;d roll it into a widget and share.</p>
<p>You&#8217;ll need to download and include the JS+CSS+images for the plugin yourself and then copy the following code into your project:</p>
<pre name="code" class="php">

class sfWidgetFormInputiPhoneCheckbox extends sfWidgetFormInputCheckbox {

	public function __construct($options = array(), $attributes = array())
	{

		$this->addOption('checked_label');
        $this->addOption('un_checked_label');

		parent::__construct($options, $attributes);
	}

	public function render($name, $value = null, $attributes = array(), $errors = array())
	{
		$str = parent::render( $name, $value, $attributes, $errors );

		$checkedLabel = $this->getOption("checked_label");
        $uncheckedLabel = $this->getOption("un_checked_label");
        $id = $this->generateId($name);

		$str .= <<<EOF
		<script type='text/javascript'>

		  $(document).ready( function(){

                $('#$id').iphoneStyle({
                    checkedLabel: '$checkedLabel',
                    uncheckedLabel: '$uncheckedLabel'
                });

		  });
		</script>
EOF;

		return $str;
	}

}
</pre>
<p>Using it is straightforward:</p>
<pre name="code" class="php">
    $this->setWidgets(array(
      'show-upcoming-events-nav' => new sfWidgetFormInputiPhoneCheckbox( array("checked_label" => "on", "un_checked_label" => "off") ),
    ));
</pre>
]]></content:encoded>
			<wfw:commentRss>http://shout.setfive.com/2010/10/13/iphone-style-checkboxes-for-symfony/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Streaming Foursquare checkins with Google Maps</title>
		<link>http://shout.setfive.com/2010/09/13/streaming-foursquare-checkins-with-google-maps/</link>
		<comments>http://shout.setfive.com/2010/09/13/streaming-foursquare-checkins-with-google-maps/#comments</comments>
		<pubDate>Tue, 14 Sep 2010 02:26:42 +0000</pubDate>
		<dc:creator>Ashish Datta</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[foursquare]]></category>
		<category><![CDATA[fun stuff]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://shout.setfive.com/?p=394</guid>
		<description><![CDATA[This Saturday was the second annual Redline Challenge which is a bar crawl from Downtown Crossing to Davis Square that loosely tracks the MBTA Redline. This year, we decided to use Foursquare to allow the website to track the position of several of the participants on the challenge. Foursquare natively allows you to track your [...]]]></description>
			<content:encoded><![CDATA[<p>This Saturday was the second annual <a href="http://redlinechallenge.com/" target="_blank">Redline Challenge</a> which is a bar crawl from Downtown Crossing to Davis Square that loosely tracks the MBTA Redline.</p>
<p>This year, we decided to use <a href="http://foursquare.com/" target="_blank">Foursquare</a> to allow the website to track the position of several of the participants on the challenge. Foursquare natively allows you to track your checkin history with private URLs. Currently, they support a handful of formats with KML being the most interesting for our purposes. You can find your private URLs by navigating to <a href="http://foursquare.com/feeds/" target="_blank">http://foursquare.com/feeds/</a></p>
<p>We used the Google Maps API along with the KML stream from Foursquare to dynamically place markers on the map as different users checked in to different venues.</p>
<p>Here is the PHP we used to pull back the KML feed, transform it to JSON, and spit it back to our jQuery on the client side:</p>
<pre name="code" class="php">
$xml = simplexml_load_file( "http://feeds.foursquare.com/history/myurl.kml" );
$arr["a"] = $xml->Folder;
$xml = simplexml_load_file( "http://feeds.foursquare.com/history/ackleysurl.kml" );
$arr["m"] = $xml->Folder;

echo json_encode( $arr );
</pre>
<p>Pretty straight forward. Here is the jQuery code on the client side to add markers to the map:</p>
<pre name="code" class="javascript">
       $.getJSON( "location.php", {}, function(data){

    	   data.a.Placemark = data.a.Placemark.reverse();

         var hasStarted = false;
         var barIndex = 1;

         $.each( data.a.Placemark, function(i, val){

               if( val.published.indexOf("Sat, 11") == -1 ){
                    return true;
               }

               if( !hasStarted &#038;&#038; val.name == "Setfive Consulting" ){
                  hasStarted = true;
               }else if( !hasStarted ){
                  return true;
               }

               var latLng = val.Point["coordinates"].split(",");

               var point = new GLatLng( latLng[1], latLng[0] );

               var marker = new GMarker(point);

               marker.bindInfoWindowHtml( "
<div style='font-size: 18px; font-weight: bold; text-align: center'>"
                                             + barIndex + ". " + val.name + "</div>
<div style='text-align: center; color: blue; font-size: 14px'><a style='color: blue' href='http://maps.google.com/maps?f=d&#038;source=s_d&#038;saddr=&#038;daddr=" + latLng[1] + "," + latLng[0] + "&#038;hl=en&#038;geocode=&#038;mra=mift&#038;mrsp=0&#038;sz=11&#038;sll=" + latLng[1] + "," + latLng[0] + "&#038;sspn=0.344495,0.617294&#038;ie=UTF8&#038;z=14' target='_blank'>Get Directions</a></div>

" );
               map.addOverlay(marker);

               latLngList.push( point );

               if( i == data.a.Placemark.length-1 ){
            	   map.setCenter(point, 14);
                   $(marker).click();

                   marker.openInfoWindowHtml( "
<div style='font-size: 18px; font-weight: bold; text-align: center'>We are at "
                		                      + barIndex + ". " + val.name
                                              + "</div>
<div style='text-align: center; color: blue; font-size: 14px'><a style='color: blue' href='http://maps.google.com/maps?f=d&#038;source=s_d&#038;saddr=&#038;daddr=" + latLng[1] + "," + latLng[0] + "&#038;hl=en&#038;geocode=&#038;mra=mift&#038;mrsp=0&#038;sz=11&#038;sll=" + latLng[1] + "," + latLng[0] + "&#038;sspn=0.344495,0.617294&#038;ie=UTF8&#038;z=14' target='_blank'>Get Directions</a></div>

" );

               }

               barIndex++;

           });
           var polyline = new GPolyline( latLngList, "#ff0000", 5 );
           map.addOverlay(polyline);

         latLngList = [];
         data.m.Placemark = data.m.Placemark.reverse();

        var blueIcon = new GIcon(G_DEFAULT_ICON);
        blueIcon.image = "http://www.google.com/intl/en_us/mapfiles/ms/micons/blue-dot.png";
        markerOptions = { icon:blueIcon };

        barIndex = 1;

        $.each( data.m.Placemark, function(i, val){

               if( val.published.indexOf("Sat, 11") == -1 ){
                    return true;
               }

               var latLng = val.Point["coordinates"].split(",");

               var point = new GLatLng( latLng[1], latLng[0] );

               var marker = new GMarker(point, markerOptions);

               marker.bindInfoWindowHtml( "
<div style='font-size: 18px; font-weight: bold; text-align: center'>"
                                             + barIndex + ". " + val.name + "</div>
<div style='text-align: center; color: blue; font-size: 14px'><a style='color: blue' href='http://maps.google.com/maps?f=d&#038;source=s_d&#038;saddr=&#038;daddr=" + latLng[1] + "," + latLng[0] + "&#038;hl=en&#038;geocode=&#038;mra=mift&#038;mrsp=0&#038;sz=11&#038;sll=" + latLng[1] + "," + latLng[0] + "&#038;sspn=0.344495,0.617294&#038;ie=UTF8&#038;z=14' target='_blank'>Get Directions</a></div>

" );
               map.addOverlay(marker);

               barIndex++;

               latLngList.push( point );

           });
           var polyline = new GPolyline( latLngList, "#001299", 5 );
           map.addOverlay(polyline);

       })
</pre>
<p>That&#8217;s about it. </p>
]]></content:encoded>
			<wfw:commentRss>http://shout.setfive.com/2010/09/13/streaming-foursquare-checkins-with-google-maps/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>UPDATED: New Facebook Phonebook Script</title>
		<link>http://shout.setfive.com/2010/07/19/updated-new-facebook-phonebook-script/</link>
		<comments>http://shout.setfive.com/2010/07/19/updated-new-facebook-phonebook-script/#comments</comments>
		<pubDate>Mon, 19 Jul 2010 19:05:24 +0000</pubDate>
		<dc:creator>Ashish Datta</dc:creator>
				<category><![CDATA[open source]]></category>
		<category><![CDATA[facebook]]></category>
		<category><![CDATA[fun stuff]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://shout.setfive.com/?p=382</guid>
		<description><![CDATA[I realized this morning that Anonymous Coward&#8217;s Facebook Phonebook Greasemonkey script broke awhile back so I decided to rewrite it from scratch. The original instructions for how to install the script are available here. I updated the original Userscripts page with the new script so you can download it here. Once again, this probably breaks [...]]]></description>
			<content:encoded><![CDATA[<p>I realized this morning that Anonymous Coward&#8217;s Facebook Phonebook Greasemonkey script broke awhile back so I decided to rewrite it from scratch.</p>
<p>The original instructions for how to install the script are available <a target="_blank" href="http://shout.setfive.com/2009/03/06/use-greasemonkey-to-extract-your-facebook-phonebook/">here</a>.</p>
<p>I updated the original Userscripts page with the new script so you can download it <a target="_blank" href="http://userscripts.org/scripts/show/43681">here</a>.</p>
<div style="font-size: 18px; font-weight: bold">
Once again, this probably breaks your Facebook TOS so I can&#8217;t vouch for the safety of your account if you do decide to do this.
</div>
]]></content:encoded>
			<wfw:commentRss>http://shout.setfive.com/2010/07/19/updated-new-facebook-phonebook-script/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>QR Bookmarklet</title>
		<link>http://shout.setfive.com/2010/06/13/qr-bookmarklet/</link>
		<comments>http://shout.setfive.com/2010/06/13/qr-bookmarklet/#comments</comments>
		<pubDate>Mon, 14 Jun 2010 03:16:43 +0000</pubDate>
		<dc:creator>Ashish Datta</dc:creator>
				<category><![CDATA[open source]]></category>
		<category><![CDATA[bookmarklet]]></category>
		<category><![CDATA[fun stuff]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://shout.setfive.com/?p=372</guid>
		<description><![CDATA[I got tired of having to find the same website (mostly recipes) on my phone after looking at them on my workstation or laptop so I decided to whip together a bookmarklet to throw a Google powered QR code on any page. The bookmarklet will just slap a QR code image with the current page&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p>I got tired of having to find the same website (mostly recipes) on my phone after looking at them on my workstation or laptop so I decided to whip together a bookmarklet to throw a Google powered QR code on any page.</p>
<p>The bookmarklet will just slap a QR code image with the current page&#8217;s URL (window.location) so that you can open the page on your phone. ps. <a href="http://www.androidtapp.com/barcode-scanner/" target="_blank">Barcode Scanner</a> for Android will automatically open the URL in a browser.</p>
<p>Without further ado, <a href="http://code.setfive.com/qrbklt/" target="_blank">QR Code Bookmarklet</a> </p>
]]></content:encoded>
			<wfw:commentRss>http://shout.setfive.com/2010/06/13/qr-bookmarklet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery.trigger weirdness</title>
		<link>http://shout.setfive.com/2010/06/10/jquery-trigger-weirdness/</link>
		<comments>http://shout.setfive.com/2010/06/10/jquery-trigger-weirdness/#comments</comments>
		<pubDate>Fri, 11 Jun 2010 03:44:42 +0000</pubDate>
		<dc:creator>Ashish Datta</dc:creator>
				<category><![CDATA[open source]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://shout.setfive.com/?p=369</guid>
		<description><![CDATA[Earlier today, I was trying to use jQuery to trigger the submission of a form after a radio button was clicked. The form tag looked something like: ...form.. function saysomething(){ alert("Hello world from saysomething()"); } So for a regular submit button: Everything works fine, you&#8217;ll see the alert() and the form won&#8217;t submit because of [...]]]></description>
			<content:encoded><![CDATA[<p>Earlier today, I was trying to use jQuery to trigger the submission of a form after a radio button was clicked. The form tag looked something like:</p>
<pre name="code" class="html">
<form action="" id="someForm" method="GET" onsubmit="saysomething(); return false">
   ...form..
   </form>

    <script type="text/javascript">

    function saysomething(){
      alert("Hello world from saysomething()");
    }

   </script>
</pre>
<p>So for a regular submit button:</p>
<pre name="code" class="html">
<input type="submit" value="Submit Form" />
</pre>
<p>Everything works fine, you&#8217;ll see the alert() and the form won&#8217;t submit because of the return false.</p>
<p>I ran into issues when I tried to trigger() the submit event with jQuery. I was trying to trigger the submit() event on the form via jQuery. The problem I ran into, was that the saysomething() function was getting called, but the &#8220;return false&#8221; seemed to have no effect.</p>
<p>The final form looked something like:</p>
<pre name="code" class="html">
<form action="" id="someForm"
          method="GET" onsubmit="saysomething(); return false">
<input type="text" name="someshit" />
<input type="submit" value="Submit Form" />
<input type="button" value="jQuery.submit()" id="clickIt" />
    </form>

    <script type="text/javascript">

    function saysomething(){
      alert("Hello world from saysomething()");
    }

    $(document).ready( function(){
      $("#clickIt").click( function(){ $("#someForm").submit(); });
    });

    </script>
</pre>
<p>For some reason, if you submit the form via a jQuery trigger the form submits even though saysomething() gets called. I&#8217;m not sure if this is the expected behavior but it was certainly something of a shock. Anyway, a live version of the form is running <a href="http://code.setfive.com/shout/formsubmit.html" target="_blank">here</a>. </p>
]]></content:encoded>
			<wfw:commentRss>http://shout.setfive.com/2010/06/10/jquery-trigger-weirdness/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Run jQuery each() serially</title>
		<link>http://shout.setfive.com/2010/05/18/run-jquery-each-serially/</link>
		<comments>http://shout.setfive.com/2010/05/18/run-jquery-each-serially/#comments</comments>
		<pubDate>Tue, 18 May 2010 22:32:51 +0000</pubDate>
		<dc:creator>Ashish Datta</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[fun stuff]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://shout.setfive.com/?p=355</guid>
		<description><![CDATA[jQuery.each() is pretty sweet but earlier today I wanted to run some animations across a set of three elements and since the animate() calls are non-blocking everything was happening at the same time. What I wanted to do was have the functions execute in a serial fashion (1 after the other). I poked around and [...]]]></description>
			<content:encoded><![CDATA[<p>jQuery.each() is pretty sweet but earlier today I wanted to run some animations across a set of three elements and since the animate() calls are non-blocking everything was happening at the same time. What I wanted to do was have the functions execute in a serial fashion (1 after the other).</p>
<p>I poked around and it doesn&#8217;t look like there&#8217;s a native way to do this. After a bit I decided to just whip something up and see how it works. Here&#8217;s what I had originally:</p>
<pre name="code" class="javascript">
$("#splashStream .snippetbox").each( function(index){
	$(this).animate( {opacity: 0}, 1000, function(){
		$(this).html( $("#hiddenSplashDiv .snippetbox:eq(" + index + ")").html() );
		$(this).animate( {opacity: 1}, 2000 );
	});
});
</pre>
<p>That ran fine but everything happened at the same time. The modified serial code looks like:</p>
<pre name="code" class="javascript">

                  var hasCallbackCompleted = [ true ];
                  $("#splashStream .snippetbox").each( function(index){

                      var f = arguments.callee;
                      var args = arguments;
                      var t = this;

                      if( !hasCallbackCompleted[ index ] ){
                        window.setTimeout( function(){ f.apply(t, args); }, 5 );
                        return true;
                      }

                      hasCallbackCompleted[ index + 1 ] = false;
                      $(this).animate( {opacity: 0}, 1000, function(){
                          $(this).html( $("#hiddenSplashDiv .snippetbox:eq(" + index + ")").html() );
                          $(this).animate( {opacity: 1}, 2000, function(){
                            hasCallbackCompleted[ index + 1 ] = true;
                          });
                      });

                  });
</pre>
<p>Basically, what it does is after the first element, the code will delay execution of the each() function until the hasCallbackCompleted flag is set for the correct element. </p>
]]></content:encoded>
			<wfw:commentRss>http://shout.setfive.com/2010/05/18/run-jquery-each-serially/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>jQuery blank() modified for password fields</title>
		<link>http://shout.setfive.com/2010/04/28/jquery-blank-modified-for-password-fields/</link>
		<comments>http://shout.setfive.com/2010/04/28/jquery-blank-modified-for-password-fields/#comments</comments>
		<pubDate>Thu, 29 Apr 2010 04:58:20 +0000</pubDate>
		<dc:creator>Ashish Datta</dc:creator>
				<category><![CDATA[open source]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://shout.setfive.com/?p=353</guid>
		<description><![CDATA[We&#8217;ve been using Jeff Hui&#8217;s very awesome jquery.blank plugin for sometime over at Setfive HQ. What blank() is allow you to basically move the labels for text inputs into the input themselves (to save space). We use this technique frequently for login boxes in headers since it&#8217;s easier not to have to stick in labels [...]]]></description>
			<content:encoded><![CDATA[<p>We&#8217;ve been using Jeff Hui&#8217;s very awesome <a target="_blank" href="http://blog.jeffhui.net/work/jquery-blank/">jquery.blank</a> plugin for sometime over at Setfive HQ. What blank() is allow you to basically move the labels for text inputs into the input themselves (to save space). We use this technique frequently for login boxes in headers since it&#8217;s easier not to have to stick in labels next to text boxes.</p>
<p>The problem is, you can&#8217;t use blank() on a password field since a password field won&#8217;t display clear text (obviously). To get around this, I&#8217;ve always manually stuck in a &#8220;shadow&#8221; text box next to the password field and toggled the text box or password box in order to make blank() work correctly.</p>
<p>Anyway, I finally got tired of doing this so I decided to patch the plugin to do this automatically. Jeff incorporated the code back into blank() and it&#8217;s available on GitHub <a target="_blank" href="http://github.com/jeffh/jquery.blank">here</a>. </p>
<p>Happy coding. </p>
]]></content:encoded>
			<wfw:commentRss>http://shout.setfive.com/2010/04/28/jquery-blank-modified-for-password-fields/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>javascript &#8211; $(document).ready getting called twice?  Here&#8217;s why.</title>
		<link>http://shout.setfive.com/2010/02/22/javascript-document-ready-getting-called-twice-heres-why/</link>
		<comments>http://shout.setfive.com/2010/02/22/javascript-document-ready-getting-called-twice-heres-why/#comments</comments>
		<pubDate>Tue, 23 Feb 2010 03:38:40 +0000</pubDate>
		<dc:creator>Matt Daum</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[bugs]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://shout.setfive.com/?p=330</guid>
		<description><![CDATA[Recently we found ourselves having a really weird problem on a project: Every time a page was loaded it seemed a bunch of different Javascript functions were being called multiple times and making many widgets on the page break and we couldn&#8217;t figure it out. Some of the functions were our own code, some part [...]]]></description>
			<content:encoded><![CDATA[<p>Recently we found ourselves having a really weird problem on a project:  Every time a page was loaded it seemed a bunch of different Javascript functions were being called multiple times and making many widgets on the page break and we couldn&#8217;t figure it out.  Some of the functions were our own code, some part of the package we were using.  After a while we narrowed it down to that all the functions in the </p>
<pre name="code" class="javascript">
$(document).ready(...);
</pre>
<p>we&#8217;re being called twice.  We had never seen this.  After about an hour of removing javascript files and just headbanging, and many thanks to Ashish, we found the root cause.  We had written in a quick hack for a late proof of concept to string replace on the entire HTML of a page a specific string.  We did it this way:</p>
<pre name="code" class="javascript">
$('body').html($('body').html().replace(/{REPLACETEXT}/i, "More important text"));
</pre>
<p>Basically we used a regex to parse the entire HTML tree and then replace it with the updated text.  Unknowingly this caused the document ready event to be triggered again(though now it makes sense), causing many widgets to get extra HTML.</p>
<p>Let this save you some headbanging. </p>
]]></content:encoded>
			<wfw:commentRss>http://shout.setfive.com/2010/02/22/javascript-document-ready-getting-called-twice-heres-why/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

