﻿<?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>Programming By A Tool &#187; jQuery</title>
	<atom:link href="http://byatool.com/tag/jquery/feed/" rel="self" type="application/rss+xml" />
	<link>http://byatool.com</link>
	<description>Voted best site in existence by a top fictious rating site!</description>
	<lastBuildDate>Wed, 28 Jul 2010 18:01:05 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>ByATool.com gets a shiny new tool!</title>
		<link>http://byatool.com/writing/byatool-com-gets-a-shiny-new-tool/</link>
		<comments>http://byatool.com/writing/byatool-com-gets-a-shiny-new-tool/#comments</comments>
		<pubDate>Wed, 31 Mar 2010 14:03:01 +0000</pubDate>
		<dc:creator>Andre</dc:creator>
				<category><![CDATA[Website News]]></category>
		<category><![CDATA[Writing]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[MVC]]></category>

		<guid isPermaLink="false">http://byatool.com/?p=1287</guid>
		<description><![CDATA[A while back, we put up an offer to write for our blog.  Only one has risen to the top as someone having both the technical know-how and the razor sharp wit required to write on a site such as this. ByATool.com Readers... Amy. Amy... ByATool.com Readers. Amy is a magnificent geek and almost 10 [...]]]></description>
			<content:encoded><![CDATA[<p>A while back, we put up an offer to write for our blog.  Only one has risen to the top as someone having both the technical know-how and the razor sharp wit required to write on a site such as this.</p>
<p>ByATool.com Readers... Amy.</p>
<p>Amy... ByATool.com Readers.</p>
<p>Amy is a magnificent geek and almost 10 year veteran of server administration  and software development. She has worked at IBM, Concurrent Technologies  Corporation, and University of Pittsburgh Medical Center.  Currently,  she is doing custom SharePoint development connected with Team  Foundation Server and the ASP.NET MVC framework development using the Entity  Framework, C#, and jQuery.  She is currently living in Pittsburgh and  not happy at all about commuting into a city with 3 rivers because of  the many bridges and no serious commuter subway systems... Who plans  this stuff?</p>
<p>Welcome Amy!</p>
<div  class="related_post_title">Related Posts</div><ul class="related_post"><li><a href="http://byatool.com/lessons/data-annotations-mvc-and-why-you-might-like-them/" title="Data Annotations, MVC, and Why You Might Like Them">Data Annotations, MVC, and Why You Might Like Them</a></li><li><a href="http://byatool.com/pontification/asp-net-mvc-quick-overview-of-controller-structure/" title="ASP.Net MVC:  Quick Overview of Controller Structure">ASP.Net MVC:  Quick Overview of Controller Structure</a></li><li><a href="http://byatool.com/pontification/aspnet-mvc-is-the-use-of-jquery-asynchronous-calls-a-must/" title="ASP.Net MVC:  Is the Use of jQuery/Asynchronous calls a Must?">ASP.Net MVC:  Is the Use of jQuery/Asynchronous calls a Must?</a></li><li><a href="http://byatool.com/pontification/are-jquery-and-asynchronous-calls-against-mvc/" title="Are jQuery and Asynchronous Calls against MVC?">Are jQuery and Asynchronous Calls against MVC?</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://byatool.com/writing/byatool-com-gets-a-shiny-new-tool/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Child IFrame Page Interacting with Parent Page&#8230; Yeah I went there.</title>
		<link>http://byatool.com/lessons/child-iframe-page-interacting-with-parent-page-yeah-i-went-there/</link>
		<comments>http://byatool.com/lessons/child-iframe-page-interacting-with-parent-page-yeah-i-went-there/#comments</comments>
		<pubDate>Mon, 08 Mar 2010 20:07:54 +0000</pubDate>
		<dc:creator>Sean</dc:creator>
				<category><![CDATA[Lessons]]></category>
		<category><![CDATA[iframe]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://byatool.com/?p=1241</guid>
		<description><![CDATA[Example here. File this under "Why?" but I wanted to see if a child could talk to a parent and then receive information back from the parent to update itself with. As usual, my lack of intelligent wording probably has you scratching your head... if you do that. Personally I don't get that expression as [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.byatool.com/Hosted/LiveDemos/JavascriptIframeDelegate/Parent.htm">Example here.</a></p>
<p>File this under "Why?" but I wanted to see if a child could talk to a parent and then receive information back from the parent to update itself with.  As usual, my lack of intelligent wording probably has you scratching your head... if you do that.  Personally I don't get that expression as when I'm confused I more than likely will grab a jar of peanut butter and start lathering up with it, but to each his own.</p>
<p>So here's the idea, and this post is only the start.</p>
<p>You have a parent page, Parent.htm, with an iframe and you want the parent to do something and alert the child that something happened.  For now, it's actually really simple.</p>
<p>On the parent I have a method:</p>
<pre>  <span style="color: #0000ff;">function</span> callMethod(text, methodDelgate) {
    <span style="color: #0000ff;">if</span> (methodDelgate != <span style="color: #0000ff;">null</span>) {
      methodDelgate(text);
    }
  }
</pre>
<p>And this simple markup:</p>
<pre>  &lt;iframe id="myFrame" src="Child.htm"&gt;&lt;/iframe&gt;
</pre>
<p>Wow huh?  Well on the child I have this:</p>
<pre>  <span style="color: #0000ff;">function</span> callParent(text) {
    <span style="color: #0000ff;">if</span> (top.callMethod != <span style="color: #0000ff;">null</span>) {
	  top.callMethod(text, changeText);
    }
  }
</pre>
<p>This is easy.  If the parent has the method, send the text through and a method to call when finished.  What is this method?  Well its:</p>
<pre>  <span style="color: #0000ff;">function </span>changeText(text) {
    jQuery(<span style="color: #800000;">'#returnText'</span>).text(text);
  }
</pre>
<p>Which simply sets the text on some div to show it actually worked.</p>
<p>What happens when I click a button that calls callParent?  It talks to the parent, the parent calls the passed in method, and the child updates itself.</p>
<p>Not sure this is rocket science, but there will be more on it as I add in the idea of a dynamically created pop up on the parent being used by the child.  Until then, try not to be yourself.  You embarrass your mother.</p>
<div  class="related_post_title">Related Posts</div><ul class="related_post"><li><a href="http://byatool.com/lessons/jquery-validation-how-to-use-to-get-rid-of-even-the-toughest-stains/" title="jQuery Validation &#8211; How to Use to Get Rid Of Even The Toughest Stains">jQuery Validation &#8211; How to Use to Get Rid Of Even The Toughest Stains</a></li><li><a href="http://byatool.com/ui/556/" title="jQuery: Add a Pop Up Div to a Link Dynamically">jQuery: Add a Pop Up Div to a Link Dynamically</a></li><li><a href="http://byatool.com/ui/jquery-position-absolute-and-how-to-make-it-all-work/" title="JQuery, Position : Absolute, and How to Make It All Work">JQuery, Position : Absolute, and How to Make It All Work</a></li><li><a href="http://byatool.com/writing/byatool-com-gets-a-shiny-new-tool/" title="ByATool.com gets a shiny new tool!">ByATool.com gets a shiny new tool!</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://byatool.com/lessons/child-iframe-page-interacting-with-parent-page-yeah-i-went-there/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Get the jQuery DatePicker to Work With jQuery Modal Dialog</title>
		<link>http://byatool.com/lessons/get-the-jquery-datepicker-to-work-with-jquery-modal-dialog/</link>
		<comments>http://byatool.com/lessons/get-the-jquery-datepicker-to-work-with-jquery-modal-dialog/#comments</comments>
		<pubDate>Wed, 27 Jan 2010 19:35:41 +0000</pubDate>
		<dc:creator>Sean</dc:creator>
				<category><![CDATA[Lessons]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://byatool.com/?p=1231</guid>
		<description><![CDATA[Being that I am the man, I thought I would share this little thingy with you because... well I'm the man. So here's the issue:  You have a date picker, a modal dialog, and you can't see the calendar when you click on the icon and/or textbox. First thought, 'WHY DOES THIS HAPPEN TO ME???!?!' [...]]]></description>
			<content:encoded><![CDATA[<p>Being that I am the man, I thought I would share this little thingy with you because... well I'm the man.</p>
<p>So here's the issue:  You have a date picker, a modal dialog, and you can't see the calendar when you click on the icon and/or textbox.  First thought, 'WHY DOES THIS HAPPEN TO ME???!?!'  Second though, 'I wonder if that tool knows how to get past this.'  Good news!  I do.  Turns out it has to do with the z-index.  The modal dialog by default has a z-index of 1000ish when showing. (And any modal dialog "above that" will increase it's z-index to match.)  If the calendar isn't higher than that, no go.  </p>
<p>Now you might be using the jquery styles from <a href="http://jqueryui.com/themeroller/"> the jquery site</a> and might be putting your through your keyboard thinking about having to deal with that mess.  However, it's actually a simple fix in there... there being the ui.datepicker.css file.</p>
<pre>
  .ui-datepicker { width: 17em; padding: .2em .2em 0;<strong> z-index:9000</strong>; }
</pre>
<p>And there you have it.  Now the calendar will show up in front of anything lower than 9000, and as everyone knows: Anything over 9000 is impossible.</p>
<div  class="related_post_title">Related Posts</div><ul class="related_post"><li><a href="http://byatool.com/writing/byatool-com-gets-a-shiny-new-tool/" title="ByATool.com gets a shiny new tool!">ByATool.com gets a shiny new tool!</a></li><li><a href="http://byatool.com/lessons/child-iframe-page-interacting-with-parent-page-yeah-i-went-there/" title="Child IFrame Page Interacting with Parent Page&#8230; Yeah I went there.">Child IFrame Page Interacting with Parent Page&#8230; Yeah I went there.</a></li><li><a href="http://byatool.com/ui/jquery-modal-dialog-hide-that-stupid-x-button-windows-close-button/" title="jQuery Modal Dialog : Hide That Stupid X Button / Windows Close Button">jQuery Modal Dialog : Hide That Stupid X Button / Windows Close Button</a></li><li><a href="http://byatool.com/ui/jquery-check-all-checkboxes-toggle-method-thingy/" title="jQuery &#8211; Check All Checkboxes Toggle Method Thingy">jQuery &#8211; Check All Checkboxes Toggle Method Thingy</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://byatool.com/lessons/get-the-jquery-datepicker-to-work-with-jquery-modal-dialog/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery Modal Dialog : Hide That Stupid X Button / Windows Close Button</title>
		<link>http://byatool.com/ui/jquery-modal-dialog-hide-that-stupid-x-button-windows-close-button/</link>
		<comments>http://byatool.com/ui/jquery-modal-dialog-hide-that-stupid-x-button-windows-close-button/#comments</comments>
		<pubDate>Tue, 12 Jan 2010 16:05:18 +0000</pubDate>
		<dc:creator>Sean</dc:creator>
				<category><![CDATA[UI]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Modal Dialog]]></category>

		<guid isPermaLink="false">http://byatool.com/?p=1213</guid>
		<description><![CDATA[This is quick one, so hold on to your... whatever. Want to get rid of that X at the top right of the modal "Control"? Well here it is: (The bold part, moron) jQuery('#WaitingDiv').dialog({ autoOpen: false, bgiframe: false, height: 150, width: 200, modal: true, open: function(event, ui) { jQuery('.ui-dialog-titlebar-close').hide(); } }); And that's really it. [...]]]></description>
			<content:encoded><![CDATA[<p>This is quick one, so hold on to your... whatever.</p>
<p>Want to get rid of that X at the top right of the modal "Control"?  Well here it is:  (The bold part, moron)</p>
<pre>     jQuery(<span style="color: #800000;">'#WaitingDiv'</span>).dialog({
          autoOpen: false,
          bgiframe: false,
          height: 150,
          width: 200,
          modal: true,
         <strong> open: function(event, ui) { jQuery(<span style="color: #800000;">'.ui-dialog-titlebar-close'</span>).hide();</strong> }
        });
</pre>
<p>And that's really it.  Just thought I'd pass that on to you, the consumer.</p>
<p>On a side note, the big movie thing is the <a href=" http://www.huffingtonpost.com/2010/01/11/spider-man-4-off-spider-m_n_419264.html">canceling of Spiderman 4 or at least going in a new direction</a>.  As much as I don't care, it might lead to my dream come true:</p>
<p>A spiderman movie based on the SNES classic: Spider-Man &amp; Venom: Maximum Carnage.  Uwe Boll, are you out there?</p>
<div  class="related_post_title">Related Posts</div><ul class="related_post"><li><a href="http://byatool.com/writing/byatool-com-gets-a-shiny-new-tool/" title="ByATool.com gets a shiny new tool!">ByATool.com gets a shiny new tool!</a></li><li><a href="http://byatool.com/lessons/child-iframe-page-interacting-with-parent-page-yeah-i-went-there/" title="Child IFrame Page Interacting with Parent Page&#8230; Yeah I went there.">Child IFrame Page Interacting with Parent Page&#8230; Yeah I went there.</a></li><li><a href="http://byatool.com/lessons/get-the-jquery-datepicker-to-work-with-jquery-modal-dialog/" title="Get the jQuery DatePicker to Work With jQuery Modal Dialog">Get the jQuery DatePicker to Work With jQuery Modal Dialog</a></li><li><a href="http://byatool.com/ui/jquery-check-all-checkboxes-toggle-method-thingy/" title="jQuery &#8211; Check All Checkboxes Toggle Method Thingy">jQuery &#8211; Check All Checkboxes Toggle Method Thingy</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://byatool.com/ui/jquery-modal-dialog-hide-that-stupid-x-button-windows-close-button/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>jQuery &#8211; Check All Checkboxes Toggle Method Thingy</title>
		<link>http://byatool.com/ui/jquery-check-all-checkboxes-toggle-method-thingy/</link>
		<comments>http://byatool.com/ui/jquery-check-all-checkboxes-toggle-method-thingy/#comments</comments>
		<pubDate>Tue, 29 Dec 2009 23:20:11 +0000</pubDate>
		<dc:creator>Sean</dc:creator>
				<category><![CDATA[UI]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://byatool.com/?p=1203</guid>
		<description><![CDATA[So here's a quick on for all you boys and girls... and anything else I might have missed. Say you want to check all check boxes in a grid or whatever, but you want it to toggle. So if if it's time to check all, all get checked and then the next time the button [...]]]></description>
			<content:encoded><![CDATA[<p>So here's a quick on for all you boys and girls... and anything else I might have missed.<br />
Say you want to check all check boxes in a grid or whatever, but you want it to toggle.  So if if it's time to check all, all get checked and then the next time the button is clicked it will uncheck.  Now you could do this in three methods, maybe two but that's why you're a mouth breather.</p>
<p>Special people like me do it in one.</p>
<pre>    <span style="color: #0000ff;">function</span> toggleCheckboxes(buttonId, checkBoxNamePrefix, checked)
    {
      <span style="color: #008000;">//Get all checkboxes with the prefix name and check/uncheck</span>
      jQuery(<span style="color: #800000;">'[id*=' + checkBoxNamePrefix + ']'</span>).attr(<span style="color: #800000;">'checked'</span>, checked);

      <span style="color: #008000;">//remove any click handlers from the button</span>
      <span style="color: #008000;">//  Why?  Because jQuery(buttonId).click() will just add another handler</span>
      jQuery(buttonId).unbind(<span style="color: #800000;">'click'</span>); 

      <span style="color: #008000;">//Add the new click handler</span>
      jQuery(buttonId).click(
        <span style="color: #0000ff;">function</span>() {
          toggleCheckboxes(buttonId, checkBoxNamePrefix, !checked);
        }
      );
    }</pre>
<p>And POW!  What?  You want to know how to use it?  Fine, but only because I'm nice.</p>
<pre>   jQuery(<span style="color: #800000;">'#buttonName'</span>).click(
     <span style="color: #0000ff;">function</span>() {
       toggleCheckboxes(<span style="color: #800000;">'#buttonName'</span>,<span style="color: #800000;"> 'someCheckBoxName'</span>, <span style="color: #0000ff;">true</span>);
     }
   );</pre>
<p>And in case you were still wondering why I used .unbind and didn't understand the comment, it's because using just .click will add another handler to the button. So next click you will get both check and uncheck all.  Kind of hurts the effectiveness.</p>
<p>And there you have it.  Once again I have filled your life with meaning.  Couldn't be easier.  Or maybe it could but that's not my problem now is it?  Go back to doing something useful.</p>
<div  class="related_post_title">Related Posts</div><ul class="related_post"><li><a href="http://byatool.com/writing/byatool-com-gets-a-shiny-new-tool/" title="ByATool.com gets a shiny new tool!">ByATool.com gets a shiny new tool!</a></li><li><a href="http://byatool.com/lessons/child-iframe-page-interacting-with-parent-page-yeah-i-went-there/" title="Child IFrame Page Interacting with Parent Page&#8230; Yeah I went there.">Child IFrame Page Interacting with Parent Page&#8230; Yeah I went there.</a></li><li><a href="http://byatool.com/lessons/get-the-jquery-datepicker-to-work-with-jquery-modal-dialog/" title="Get the jQuery DatePicker to Work With jQuery Modal Dialog">Get the jQuery DatePicker to Work With jQuery Modal Dialog</a></li><li><a href="http://byatool.com/ui/jquery-modal-dialog-hide-that-stupid-x-button-windows-close-button/" title="jQuery Modal Dialog : Hide That Stupid X Button / Windows Close Button">jQuery Modal Dialog : Hide That Stupid X Button / Windows Close Button</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://byatool.com/ui/jquery-check-all-checkboxes-toggle-method-thingy/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>jQuery Validation: Adding Errors to the Error Containter&#8230; With Love!</title>
		<link>http://byatool.com/lessons/jquery-validation-adding-errors-to-the-error-containter-with-love/</link>
		<comments>http://byatool.com/lessons/jquery-validation-adding-errors-to-the-error-containter-with-love/#comments</comments>
		<pubDate>Tue, 22 Dec 2009 21:28:49 +0000</pubDate>
		<dc:creator>Sean</dc:creator>
				<category><![CDATA[Lessons]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Validation]]></category>

		<guid isPermaLink="false">http://byatool.com/?p=1178</guid>
		<description><![CDATA[Hello again, my wonderful audience, I have something great and fun planned for this post. If you read this post you might have been left wondering how to add custom messages to the error holder. It's ok if you did, there's nothing wrong with being confused all the time. It's what makes you so adorable. [...]]]></description>
			<content:encoded><![CDATA[<pre><img src="http://www.iheartvector.com/wp-content/vector/hearts.png" alt="" /></pre>
<p><span style="background-color: #FFFFFF;" title="Please send help, the Board of Directors is forcing me to be nice!">Hello again, my wonderful audience, I have something great and fun planned for this post. If you read <a href="http://byatool.com/lessons/jquery-validation-how-to-use-to-get-rid-of-even-the-toughest-stains/">this post</a> you might have been left wondering how to add custom messages to the error holder. It's ok if you did, there's nothing wrong with being confused all the time. It's what makes you so adorable.</span></p>
<p><span style="background-color: #FFFFFF;" title="I really don't mean the last part.">Say you have a form like this, and if you don't I cry endlessly for your loss. My heart goes out to you.</span></p>
<pre>&lt;<span style="color: #800000;">form</span> <span style="color: #0000ff;">id=</span><span style="color: #ff0000;">"ILoveEverythingForm"</span>&gt;
    &lt;<span style="color: #800000;">div</span> <span style="color: #0000ff;">id=</span><span style="color: #ff0000;">"NotSoNiceThingsDiv"</span> <span style="color: #0000ff;">style</span><span style="color: #0000ff;">=</span><span style="color: #ff0000;">"display:none;"</span>&gt;&lt;/<span style="color: #800000;">div</span>&gt;
	...
&lt;/<span style="color: #800000;">form</span>&gt;</pre>
<p><span style="background-color: #FFFFFF;" title="This is the cheesiest piece of...">As you can see, there is an error div to hold mean things that we have to print out because the system just doesn't like the user. As we both know, the user can't help but be dumb. It's just in his cute little nature. And that nature is just so darned cute.</span></p>
<p><span style="background-color: #FFFFFF;" title="Uhg, this really sucks.">Now let's assume that you have something that sent back a bunch of mean messages when you tried to validate server side after all the cute client side validation was done. You might have a method to take in those jerk face messages. How do you display them in the bad place?</span></p>
<pre>  <span style="color: #0000ff;">function</span> updateErrorDivContentWithLove(messages)
  {
    <span style="color: #0000ff;">if</span>(messages.length &gt; 0)
    {
      <span style="color: #0000ff;">var</span> validator = jQuery(<span style="color: #800000;">'#ILoveEverythingForm'</span>).validate();

      <span style="color: #0000ff;">for</span>(<span style="color: #0000ff;">var</span> loopCounter = 0; loopCounter &lt; messages.length; loopCounter ++)
      {
        validator.showErrors
        (
          {
             <span style="color: #800000;">'SomeWonderfulElementName'</span> : messages[loopCounter].Message
          }
        );
      }
    }
  }</pre>
<p><span style="background-color: #FFFFFF;" title="I wish I could stab my eyes right now...">Awwww kitties!</span></p>
<pre>  <img src="http://www.dailypets.co.uk/wp-content/uploads/2007/06/kittens-cups.jpg" alt="" /></pre>
<p><span style="background-color: #FFFFFF;" title="I am losing mad rep on this.">Only thing that may seem odd (And if it doesn't, don't worry you are still very special and loved in this world):</span></p>
<pre>  'SomeElementName' : messages[loopCounter].Message</pre>
<p><span style="background-color: #FFFFFF;" title="Oh for f--ks sake...">Not sure what element really needs to be here, basically anything in the form with a name tag. So if you're good like I know you are, you have at least one element in that little old form with a name property set. I would say that this is pretty useless in situations where all the errors are shown in one div, as opposed to right next to the element, but that would be mean and I don't do that.</span></p>
<p><span style="background-color: #FFFFFF;" title="I swear I'm not really a nice person, please believe me.">Now I know you wanted something special from this post so I just wanted you to know that even though most of the world considers you hideous, I say you should be proud of being hideous because it makes you who you are. A unique miracle that only really has issues with dogs and small children. Embrace yourself in whatever way you take that!</span></p>
<div  class="related_post_title">Related Posts</div><ul class="related_post"><li><a href="http://byatool.com/lessons/jquery-validation-how-to-use-to-get-rid-of-even-the-toughest-stains/" title="jQuery Validation &#8211; How to Use to Get Rid Of Even The Toughest Stains">jQuery Validation &#8211; How to Use to Get Rid Of Even The Toughest Stains</a></li><li><a href="http://byatool.com/writing/byatool-com-gets-a-shiny-new-tool/" title="ByATool.com gets a shiny new tool!">ByATool.com gets a shiny new tool!</a></li><li><a href="http://byatool.com/lessons/child-iframe-page-interacting-with-parent-page-yeah-i-went-there/" title="Child IFrame Page Interacting with Parent Page&#8230; Yeah I went there.">Child IFrame Page Interacting with Parent Page&#8230; Yeah I went there.</a></li><li><a href="http://byatool.com/lessons/get-the-jquery-datepicker-to-work-with-jquery-modal-dialog/" title="Get the jQuery DatePicker to Work With jQuery Modal Dialog">Get the jQuery DatePicker to Work With jQuery Modal Dialog</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://byatool.com/lessons/jquery-validation-adding-errors-to-the-error-containter-with-love/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery Grab Bag &#8211; Whole bunch of jQuery Functionality</title>
		<link>http://byatool.com/ui/jquery-grab-bag-whole-bunch-of-jquery-functionality/</link>
		<comments>http://byatool.com/ui/jquery-grab-bag-whole-bunch-of-jquery-functionality/#comments</comments>
		<pubDate>Fri, 11 Dec 2009 21:06:32 +0000</pubDate>
		<dc:creator>Sean</dc:creator>
				<category><![CDATA[UI]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://byatool.com/?p=1125</guid>
		<description><![CDATA[You could look at this post as a self serving block that I will use to save stuff I don't want to remember later. Or you could see it as a knowledge transfer that you the reader can learn from because I am a generous and giving tool. Whatever, I really don't care. I won't [...]]]></description>
			<content:encoded><![CDATA[<p>You could look at this post as a self serving block that I will use to save stuff I don't want to remember later.</p>
<p>Or you could see it as a knowledge transfer that you the reader can learn from because I am a generous and giving tool.</p>
<p>Whatever, I really don't care.  I won't sleep any differently.  I just don't feel like making 1000 posts of jquery stupidity.</p>
<p>I'll add more as I come across them.</p>
<h2>Checkbox</h2>
<p><strong>How To Check a CheckBox</strong></p>
<pre>  jQuery(<span style="color: #800000;">'#CheckBoxId'</span>).attr(<span style="color: #800000;">'checked'</span>, <span style="color: #0000ff;">false</span>);</pre>
<p><strong>How To Know if a Checkbox is Checked</strong></p>
<pre>  jQuery(<span style="color: #800000;">'#CheckBoxId'</span>).is(<span style="color: #800000;">':checked'</span>)</pre>
<p><strong>How To Find a Bunch of Like Named Checkboxes that are Checked</strong></p>
<pre>  jQuery(<span style="color: #800000;">'[id*=someCheckBox_]:checked'</span>);</pre>
<h2>Drop Down Lists</h2>
<p><strong>How to Add an Item/Option to a Drop Down List</strong></p>
<pre> jQuery(<span style="color: #800000;">'#DropDownListId'</span>).append(jQuery(<span style="color: #800000;">'&lt;option&gt;'</span>).val(1).html(<span style="color: #800000;">"SomeText"</span>));</pre>
<p>Odd Note:  Apparently jquery is smart enough to set the attributes on the option AND close the option with &lt;/option&gt;</p>
<p><strong>How to Remove an Item/Option from a Drop Down List</strong></p>
<pre>  jQuery(<span style="color: #800000;">'#DropDownListId option[value=\'3\']'</span>).remove();</pre>
<p><strong>How to Sort a Drop Down List by Option Text</strong></p>
<pre>  <span style="color: #0000ff;">var</span> sortedList = jQuery(<span style="color: #800000;">'#someDropDownList option'</span>).sort(
    <span style="color: #0000ff;">function</span> (first, second) {
      <span style="color: #0000ff;">return</span> first.text == second.text ? 0 : first.text &lt; second.text ? -1 : 1;
    }
  );

  jQuery(<span style="color: #800000;">'#someDropDownList'</span>).html(sortedList);</pre>
<h2>Elements</h2>
<p><strong> How to Filter Out an Element in a List</strong></p>
<pre>  someElementList.filter(<span style="color: #800000;">'[id=someId]'</span>);</pre>
<p>Example:</p>
<pre><span style="color: #008000;">  //Uncheck all id like someId_ and check only where id = someId_1</span>
<span style="color: #0000ff;">  var</span> someElementList = someElement.children(<span style="color: #800000;">'[id*=someId_]'</span>);
  someElementList.attr(<span style="color: #800000;">'checked'</span>, <span style="color: #0000ff;">false</span>);
  someElementList.filter(<span style="color: #800000;">'[id=someId_1]'</span>).attr(<span style="color: #800000;">'checked'</span>, <span style="color: #0000ff;">true</span>);</pre>
<p><strong>How To Find an Element Based on a Like Name/Using Wildcards</strong></p>
<pre>  jQuery(<span style="color: #800000;">'#SomeTable'</span>).children(<span style="color: #800000;">'tr[id*=SomeRowId]'</span>);</pre>
<p><strong>How To Know if a Something is Hidden</strong></p>
<pre>  jQuery(<span style="color: #800000;">'#CheckBoxId'</span>).is(<span style="color: #800000;">':hidden'</span>)</pre>
<p>Possible Use:</p>
<pre> <span style="color: #0000ff;">function</span> showOrHide(element) {
    <span style="color: #0000ff;">if</span>(jQuery(element).is(<span style="color: #800000;">':hidden'</span>)) {
      jQuery(element).show();
    }
    <span style="color: #0000ff;">else</span> {
      jQuery(element).hide();
    }
  }</pre>
<p><strong>How to Disable an Input/Select</strong></p>
<pre>  jQuery(<span style="color: #800000;">'#DropDownListId'</span>).attr(<span style="color: #800000;">'disabled'</span>, <span style="color: #800000;">'disabled'</span>);</pre>
<p><strong>How to Enable an Input/Select</strong></p>
<pre>  jQuery(<span style="color: #800000;">'#DropDownListId'</span>).removeAttr(<span style="color: #800000;">'disabled'</span>);</pre>
<p><strong>How to Know if an Element Exists</strong></p>
<pre>  jQuery(<span style="color: #800000;">'#ElementId'</span>).length &gt; 0</pre>
<p>Possible use:</p>
<pre>  <span style="color: #0000ff;">function</span> elementExists(elementId) {
    <span style="color: #0000ff;">return</span> jQuery(elementId).length &gt; 0;
  }</pre>
<h2>String</h2>
<p><strong>How To Remove the First Character from a String</strong></p>
<pre>  someString.substring(1, someString.length)</pre>
<h2>Tables</h2>
<p><strong>How to Add a Row to a Table</strong></p>
<pre>  jQuery(<span style="color: #800000;">'#TableId &gt; tbody:last'</span>).append(<span style="color: #800000;">'&lt;tr&gt;...&lt;/tr&gt;'</span>)</pre>
<p><strong>How to Remove a Table Row</strong></p>
<pre>  jQuery(<span style="color: #800000;">'#TableId &gt; tbody:last'</span>).children(someSortOfRowId).remove();</pre>
<h2>Methods</h2>
<p><strong>How to Post With a Link</strong></p>
<pre>  <span style="color: #0000ff;">function</span> postToUrl(path, params)
  {
    <span style="color: #0000ff;">var</span> method = "post"; 

    <span style="color: #0000ff;">var</span> form = document.createElement(<span style="color: #800000;">"form"</span>);
    form.setAttribute(<span style="color: #800000;">"method"</span>, method);
    form.setAttribute(<span style="color: #800000;">"action"</span>, path);
    for(<span style="color: #0000ff;">var</span> key <span style="color: #0000ff;">in</span> params)
    {
        var hiddenField = document.createElement(<span style="color: #800000;">"input"</span>);
        hiddenField.setAttribute(<span style="color: #800000;">"type"</span>, <span style="color: #800000;">"hidden"</span>);
        hiddenField.setAttribute(<span style="color: #800000;">"name"</span>, key);
        hiddenField.setAttribute(<span style="color: #800000;">"value"</span>, params[key]);
        form.appendChild(hiddenField);
    }
    document.body.appendChild(form);    

    form.submit();
  }</pre>
<p>Use:</p>
<pre>&lt;a href="javascript:postToUrl('/SomeController/SomeAction/', { 'id', '1' })"&gt;link&lt;/a&gt;</pre>
<div  class="related_post_title">Related Posts</div><ul class="related_post"><li><a href="http://byatool.com/writing/byatool-com-gets-a-shiny-new-tool/" title="ByATool.com gets a shiny new tool!">ByATool.com gets a shiny new tool!</a></li><li><a href="http://byatool.com/lessons/child-iframe-page-interacting-with-parent-page-yeah-i-went-there/" title="Child IFrame Page Interacting with Parent Page&#8230; Yeah I went there.">Child IFrame Page Interacting with Parent Page&#8230; Yeah I went there.</a></li><li><a href="http://byatool.com/lessons/get-the-jquery-datepicker-to-work-with-jquery-modal-dialog/" title="Get the jQuery DatePicker to Work With jQuery Modal Dialog">Get the jQuery DatePicker to Work With jQuery Modal Dialog</a></li><li><a href="http://byatool.com/ui/jquery-modal-dialog-hide-that-stupid-x-button-windows-close-button/" title="jQuery Modal Dialog : Hide That Stupid X Button / Windows Close Button">jQuery Modal Dialog : Hide That Stupid X Button / Windows Close Button</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://byatool.com/ui/jquery-grab-bag-whole-bunch-of-jquery-functionality/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>jQuery Validation &#8211; How to Use to Get Rid Of Even The Toughest Stains</title>
		<link>http://byatool.com/lessons/jquery-validation-how-to-use-to-get-rid-of-even-the-toughest-stains/</link>
		<comments>http://byatool.com/lessons/jquery-validation-how-to-use-to-get-rid-of-even-the-toughest-stains/#comments</comments>
		<pubDate>Sun, 06 Dec 2009 18:17:29 +0000</pubDate>
		<dc:creator>Sean</dc:creator>
				<category><![CDATA[Lessons]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Validation]]></category>

		<guid isPermaLink="false">http://byatool.com/?p=1092</guid>
		<description><![CDATA[So you want to use jQuery validation, huh? What is it? Something that was added to the holy jquery site and is an easy way to validate input from users. Now this should in no way take over for server side validation, but it helps to at least catch a few things without having to [...]]]></description>
			<content:encoded><![CDATA[<p>So you want to use jQuery validation, huh?</p>
<p>What is it?  Something that was added to the<a href="http://jquery.com/"> <strong>holy jquery site</strong></a> and is an easy way to validate input from users. Now this should in no way take over for server side validation, but it helps to at least catch a few things without having to send anything to the server.  So how do ya do it?</p>
<p>Well to start, you need some files:</p>
<p><a href="http://docs.jquery.com/Release:jQuery_1.3.2">jquery-1.3.2.js</a> and <a href="http://bassistance.de/jquery-plugins/jquery-plugin-validation/">jquery.validate.js</a>.</p>
<p>Now oddly enough the validation file isn't hosted on the <a href="http://jquery.com/"> <strong>holy jquery site</strong></a> but <a href="http://docs.jquery.com/Plugins/Validation">how to use it is</a>.</p>
<p>Ok now you have the files, what's next?  Well you need form, and <a href="http://byatool.com/hosted/LiveDemos/jQueryValidation/SimpleRequired.html">I can do that for you.</a></p>
<p>So basically it's a simple form with one input that is required.</p>
<pre>jQuery(document).ready
    (
      <span style="color: #0000ff;">function</span>()
      {
        jQuery(<span style="color: #800000;">"#PrimaryForm"</span>).validate
        (
          {
            errorLabelContainer: <span style="color: #800000;">"#ErrorDiv"</span>,
            wrapper: <span style="color: #800000;">"div"</span>,
            rules:
            {
              FirstName :
              {
                required : <span style="color: #0000ff;">true</span>
              }
            },
            messages:
            {
              FirstName:
              {
                required : <span style="color: #800000;">'First Name is required.'</span>
              }
            },
            onfocusout : false,
            onkeyup: false,
            submitHandler: <span style="color: #0000ff;">function</span>(label)
            {
              postSubmit();
            }
          }
        );
      }</pre>
<pre>jQuery(<span style="color: #800000;">"#PrimaryForm"</span>).validate</pre>
<p>Real simple, just setting the validator to the primary form on the page.</p>
<pre> errorLabelContainer: <span style="color: #800000;">"#ErrorDiv"</span>,</pre>
<p>This sets the errors to show up in the ErrorDiv.  Now this is optional, as you can have it show the errors next to the FirstName text box but personally I think that looks horrible.  Setting up the ErrorDiv puts all the errors in one central location and allows for styling the actual div.</p>
<pre> rules:
 {
    FirstName :
    {
      required : <span style="color: #0000ff;">true</span>
    }
  },</pre>
<p>This matches an element with the id of FirstName to the required rule, meaning that FirstName is required.  Rocket science.</p>
<pre>  messages:
  {
    FirstName:
    {
       required : <span style="color: #800000;">'First Name is required.'</span>
    }
  },</pre>
<p>If you can't figure this out, I hear circus is hiring for the "World's Dumbest Person".  You'll fit in with Jub Jub the Dog Boy.</p>
<pre>  onfocusout : <span style="color: #0000ff;">false</span>,
  onkeyup: <span style="color: #0000ff;">false</span>,</pre>
<p>Basically this prevents the validation when leaving the textbox or on every key press.  This is just another preference.</p>
<pre>  submitHandler: <span style="color: #0000ff;">function</span>(label)
  {
    postSubmit();
  }</pre>
<p>If the submit is successful, call this method.</p>
<p><strong>But... BUT WHAT IF IT'S AN EMAIL?!??! WHAT WILL I DO???!?!?</strong></p>
<p>Well for one, stop being such a child.  <a href="http://byatool.com/hosted/LiveDemos/jQueryValidation/EmailRequired.html">And two, look here.</a></p>
<p>Some what different, as you can see it's now email and there is one extra requirement in the rules:</p>
<pre>  rules:
  {
    EmailAddress :
    {
      email : <span style="color: #0000ff;">true</span>,
      required : <span style="color: #0000ff;">true</span>
    }
  },
  messages:
  {
    EmailAddress:
    {
      required : <span style="color: #800000;">'Yo, email fool.'</span>,
      email : <span style="color: #800000;">'So not an email address.'</span>
    },
  },</pre>
<p>See?  It has nice built in rule for email.  Simple.</p>
<p><strong>BUT WHAT IF I NEED A REGULAR EXPRESSION?!??! WHAT WILL I DO???!?!?</strong></p>
<p>I swear if you don't stop that, I'm turning this post around and going home.</p>
<p><a href="http://byatool.com/hosted/LiveDemos/jQueryValidation/ZipCodeRequired.html">Fine here it is.</a></p>
<pre>  jQuery.validator.addMethod
  (
    <span style="color: #800000;">"isZipCode"</span>,
    <span style="color: #0000ff;">function</span>(value, element)
    {
      <span style="color: #0000ff;">return</span> value.match(<span style="color: #0000ff;">new</span> RegExp(/(^\d{5}$)|(^\d{5}-\d{4}$)/));
    }
  );</pre>
<p>Just have to create a method and "add it" to the validator itself. And then there's the use:</p>
<pre>  rules:
  {
    ZipCode :
    {
      required : <span style="color: #0000ff;">true</span>,
      isZipCode : <span style="color: #0000ff;">true</span>
    }
  },
  messages:
  {
    ZipCode:
    {
      required : <span style="color: #800000;">'For the love of me, enter a zip code!.'</span>,
      isZipCode : <span style="color: #800000;">'Serioulsy?  Do you know what a zip code is?'</span>
    },
  },</pre>
<p>Woo hoo right?</p>
<p>Don't do it... Don't you yell.</p>
<p><strong>But what if one input depends on another?</strong></p>
<p>Much better.  Well that's not as hard as it may seem and <a href="http://byatool.com/hosted/LiveDemos/jQueryValidation/TwoRequired.html">here's the example</a>.</p>
<pre>  rules:
  {
    InputB :
    {
      required :
      {
        depends : <span style="color: #0000ff;">function</span>(element) { <span style="color: #0000ff;">return</span> jQuery(<span style="color: #800000;">'#InputA'</span>).val() != <span style="color: #800000;">""</span> }
      }
    }
  },</pre>
<p>As you can see, you can change how the required method works by adding in a depends handler.  Works out pretty well.</p>
<p>Yes I will show you how to make sure two inputs match.  <a href="http://byatool.com/hosted/LiveDemos/jQueryValidation/EqualTo.html">I swear you ask for a lot.</a></p>
<pre>  rules:
  {
    Password :
    {
      equalTo : <span style="color: #800000;">"#ConfirmPassword"
</span>    },
  },</pre>
<p>Couldn't be easier unless I wrote it out for you.  Wait, I did.</p>
<p>So here you've either learned a bit about jQuery validation or have just spent the last few minutes drooling uncontrollably. Either way, I'm done with this post and you're left to do whatever it is you do, you sick f---.</p>
<p>Side note:  I haven't actually been to <a href="http://www.htmlgoodies.com">Htmlgoodies</a> since eh college?  but wow did that place sell out.  How fitting that an introduction to html page now looks like it was designed by someone just starting out... in the 90s.</p>
<div  class="related_post_title">Related Posts</div><ul class="related_post"><li><a href="http://byatool.com/lessons/child-iframe-page-interacting-with-parent-page-yeah-i-went-there/" title="Child IFrame Page Interacting with Parent Page&#8230; Yeah I went there.">Child IFrame Page Interacting with Parent Page&#8230; Yeah I went there.</a></li><li><a href="http://byatool.com/lessons/jquery-validation-adding-errors-to-the-error-containter-with-love/" title="jQuery Validation: Adding Errors to the Error Containter&#8230; With Love!">jQuery Validation: Adding Errors to the Error Containter&#8230; With Love!</a></li><li><a href="http://byatool.com/ui/556/" title="jQuery: Add a Pop Up Div to a Link Dynamically">jQuery: Add a Pop Up Div to a Link Dynamically</a></li><li><a href="http://byatool.com/ui/jquery-position-absolute-and-how-to-make-it-all-work/" title="JQuery, Position : Absolute, and How to Make It All Work">JQuery, Position : Absolute, and How to Make It All Work</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://byatool.com/lessons/jquery-validation-how-to-use-to-get-rid-of-even-the-toughest-stains/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>ASP.Net MVC:  Quick Overview of Controller Structure</title>
		<link>http://byatool.com/pontification/asp-net-mvc-quick-overview-of-controller-structure/</link>
		<comments>http://byatool.com/pontification/asp-net-mvc-quick-overview-of-controller-structure/#comments</comments>
		<pubDate>Mon, 26 Oct 2009 16:37:47 +0000</pubDate>
		<dc:creator>Sean</dc:creator>
				<category><![CDATA[Pontification]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[MVC]]></category>

		<guid isPermaLink="false">http://byatool.com/?p=1012</guid>
		<description><![CDATA[Wow, that's a mouthful far as titles go, but couldn't think of a better way to say it. Now what I'm about to go through is the "system" I have found that works pretty well when it comes to structuring controllers knowing that there will be asynchronous operations. Why is that a big deal? Well [...]]]></description>
			<content:encoded><![CDATA[<p>Wow, that's a mouthful far as titles go, but couldn't think of a better way to say it.  Now what I'm about to go through is the "system" I have found that works pretty well when it comes to structuring controllers knowing that there will be asynchronous operations.  Why is that a big deal?  Well where you put certain methods can depend on which controller actually owns the action.</p>
<p>When I started using MVC, I had some issues on figuring out how to build controllers so that they made sense from a structural point of view.  <a href="http://byatool.com/index.php/pontification/what-i-hate-about-programming/">I slightly touched on it</a> but I wanted to show where I progressed to in the vain hope that I can help prevent stumbling on your part.</p>
<p>One thing to be noted is the asynchronous part.  I've become a firm believer that MVC is pointless without asynchronous operations.  Why?  Simply put, you can use them or you can come up with some annoying post and redirect for any create, update, or delete operations.  If you're going to do that, you might as well just be institutionalized because you are one masochistic mother f---er.  For everyone else in the happy world, go with something like jQuery that makes it real easy to perform said operations.</p>
<p>With the last paragraph in mind, the part I had trouble with the most was figuring out where the actions go.  You see, when I started using MVC, I grouped stuff in an ultra simple manor.  Say I have a site for handling pictures.  Well there would be a view controller that would have anything to do with viewing images and an admin controller that took care of the uploading, changing, deleting, ecting.  As you can imagine, this was not what you might call ideal.</p>
<p>Once I got a feeling for MVC and how it worked, I started having things a little more separated but still didn't feel right.  I had actions for viewing a list of images on the image controller no matter if public or admin side which wasn't really ideal to me since it kind of blurred what was public and what was restricted from a conceptual point of view.  </p>
<p>It wasn't until I started thinking in terms of unit testing that it started to make more sense.  If I were creating controllers as if they were classes instead of pages like with WebForms, maybe it would work out better.  Seems real profound right?  Well it was at the time since I still had WebForms state of mind.  All of a sudden, it made way more sense on how the controllers should be set up.  In an odd way, the controllers almost became almost business layer like.  If I wanted to update an Image, there would be an Update method on the image controller responsible for taking in the changes, validating, and dealing with the entity objects.  Everything that had to do strictly with displaying information would be handled by a display controller like the before mentioned Admin controller.  So something like:</p>
<pre>
<img src="http://www.iamwebproject.com/PhotoView/Photo/ShowPhoto/14" alt="Controller Outline" />
</pre>
<p>As you can see, the Admin controller has something to show all users.  The User controller has the methods for things like updating, creating, and validation.  Basically anything that would change an image is on one controller.  Anything for showing it on the main section controller.  That is, a controller that embodies an overall concept like say an Admin section of a site or possibly a controller for viewing galleries.  </p>
<p>The sequence of events (bad word choice...) would be something like:</p>
<p>Open Admin/UserList/<br />
Admin controller uses User Entity to retrieve list<br />
Admin View shows User List<br />
User clicks delete button/link on Admin View<br />
Javascript/jQuery method invoked to send id to User/Delete<br />
User controller receives id<br />
User controller validates id to make sure it is valid<br />
User controller validates current user to see if allowed to delete<br />
User entity Delete method invoked by User Controller<br />
Result of Delete Method is returned by User Controller (JSon preferably)<br />
Admin View displays the result</p>
<p>Treating controllers like classes (and the use of anonymous actions) allows a very clean separation of actions resulting in a nice logical layout.  Beyond this, it also allows for a greater separation between controllers which means its possible to do multiple parts of the entire project in parallel.</p>
<p>Maybe this is just stating the obvious, something I'm pretty good at, but my hope was to give a quick over view of laying out controllers for those who are just starting out.</p>
<div  class="related_post_title">Related Posts</div><ul class="related_post"><li><a href="http://byatool.com/writing/byatool-com-gets-a-shiny-new-tool/" title="ByATool.com gets a shiny new tool!">ByATool.com gets a shiny new tool!</a></li><li><a href="http://byatool.com/pontification/aspnet-mvc-is-the-use-of-jquery-asynchronous-calls-a-must/" title="ASP.Net MVC:  Is the Use of jQuery/Asynchronous calls a Must?">ASP.Net MVC:  Is the Use of jQuery/Asynchronous calls a Must?</a></li><li><a href="http://byatool.com/pontification/are-jquery-and-asynchronous-calls-against-mvc/" title="Are jQuery and Asynchronous Calls against MVC?">Are jQuery and Asynchronous Calls against MVC?</a></li><li><a href="http://byatool.com/lessons/spark-view-engine-asp-net-mvc-and-you/" title="Spark View Engine, ASP.Net MVC, and You">Spark View Engine, ASP.Net MVC, and You</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://byatool.com/pontification/asp-net-mvc-quick-overview-of-controller-structure/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery: Find All Checked Checkboxes</title>
		<link>http://byatool.com/ui/jquery-find-all-checked-checkboxes/</link>
		<comments>http://byatool.com/ui/jquery-find-all-checked-checkboxes/#comments</comments>
		<pubDate>Tue, 06 Oct 2009 15:14:27 +0000</pubDate>
		<dc:creator>Sean</dc:creator>
				<category><![CDATA[UI]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://byatool.com/?p=909</guid>
		<description><![CDATA[So this is sort of a repeat of another post, but I figured it has some use on its own. Say you have this: &#60;div&#62; &#60;input type="checkbox" name="JqueryIdList" value="1" /&#62; &#60;input type="checkbox" name="JqueryIdList" value="2" /&#62; &#60;input type="checkbox" name="JqueryIdList" value="3" /&#62; &#60;input type="checkbox" name="JqueryIdList" value="4" /&#62; &#60;/div&#62; &#60;div onclick="getIds('JqueryIdList');"&#62; CLICK &#60;/div&#62; And you need the getIds [...]]]></description>
			<content:encoded><![CDATA[<p>So this is sort of a repeat of another post, but I figured it has some use on its own.</p>
<p>Say you have this:</p>
<pre>  &lt;<span style="color: #800000;">div</span>&gt;
    &lt;<span style="color: #800000;">input</span> <span style="color: #ff0000;">type</span><span style="color: #0000ff;">="checkbox"</span> <span style="color: #ff0000;">name</span><span style="color: #0000ff;">="JqueryIdList"</span> <span style="color: #ff0000;">value</span><span style="color: #0000ff;">="1"</span>  /&gt;
    &lt;<span style="color: #800000;">input</span> <span style="color: #ff0000;">type</span><span style="color: #0000ff;">="checkbox"</span> <span style="color: #ff0000;">name</span><span style="color: #0000ff;">="JqueryIdList"</span> <span style="color: #ff0000;">value</span><span style="color: #0000ff;">="2"</span> /&gt;
    &lt;<span style="color: #800000;">input</span> <span style="color: #ff0000;">type</span><span style="color: #0000ff;">="checkbox"</span> <span style="color: #ff0000;">name</span><span style="color: #0000ff;">="JqueryIdList"</span> <span style="color: #ff0000;">value</span><span style="color: #0000ff;">="3"</span> /&gt;
    &lt;<span style="color: #800000;">input</span> <span style="color: #ff0000;">type</span><span style="color: #0000ff;">="checkbox"</span> <span style="color: #ff0000;">name</span><span style="color: #0000ff;">="JqueryIdList"</span> <span style="color: #ff0000;">value</span><span style="color: #0000ff;">="4"</span> /&gt;
  &lt;/<span style="color: #800000;">div</span>&gt;
  &lt;<span style="color: #800000;">div</span> <span style="color: #ff0000;">onclick</span><span style="color: #0000ff;">="getIds('JqueryIdList');"</span>&gt;
    CLICK
  &lt;/<span style="color: #800000;">div</span>&gt;</pre>
<p>And you need the getIds method to find all the checked checkboxes from that markup. Well it's actually fairly simple, or at least it wil be once I enlighten you. I should get paid for this...</p>
<pre>  <span style="color: #0000ff;">function</span> getIds(checkList)
  {
    <span style="color: #0000ff;">var</span> idList = <span style="color: #0000ff;">new</span> <span style="color: #008080;">Array</span>();
    <span style="color: #0000ff;">var</span> loopCounter = 0;
    <span style="color: #008000;">//find all the checked checkboxes</span>
    jQuery(<span style="color: #800000;">"input[name="</span> + checkList + <span style="color: #800000;">"]:checked"</span>).each
    (
      <span style="color: #0000ff;">function</span>()
      {
        <span style="color: #008000;">//fill the array with the values</span>
        idList[loopCounter] = jQuery(<span style="color: #0000ff;">this</span>).val();
        loopCounter += 1;
      }
    );
    ...
  }</pre>
<p>The important part is this:</p>
<pre>
 jQuery(<span style="color: #800000;">"input[name="</span> + checkList + <span style="color: #800000;">"]:checked"</span>).</pre>
<p>As you can see, it is very simple.  Give it the name of the checkboxes, add on the ":checked" and boom you have a list of checked checkboxes.  Could it be more simple?  I think not.</p>
<div  class="related_post_title">Related Posts</div><ul class="related_post"><li><a href="http://byatool.com/writing/byatool-com-gets-a-shiny-new-tool/" title="ByATool.com gets a shiny new tool!">ByATool.com gets a shiny new tool!</a></li><li><a href="http://byatool.com/lessons/child-iframe-page-interacting-with-parent-page-yeah-i-went-there/" title="Child IFrame Page Interacting with Parent Page&#8230; Yeah I went there.">Child IFrame Page Interacting with Parent Page&#8230; Yeah I went there.</a></li><li><a href="http://byatool.com/lessons/get-the-jquery-datepicker-to-work-with-jquery-modal-dialog/" title="Get the jQuery DatePicker to Work With jQuery Modal Dialog">Get the jQuery DatePicker to Work With jQuery Modal Dialog</a></li><li><a href="http://byatool.com/ui/jquery-modal-dialog-hide-that-stupid-x-button-windows-close-button/" title="jQuery Modal Dialog : Hide That Stupid X Button / Windows Close Button">jQuery Modal Dialog : Hide That Stupid X Button / Windows Close Button</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://byatool.com/ui/jquery-find-all-checked-checkboxes/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>ASP.Net MVC How To Handle Multiple Checkboxes With Views/Actions&#8230; jQuery too!</title>
		<link>http://byatool.com/mvc/asp-net-mvc-how-to-handle-multiple-checkboxes-with-viewsactions-jquery-too/</link>
		<comments>http://byatool.com/mvc/asp-net-mvc-how-to-handle-multiple-checkboxes-with-viewsactions-jquery-too/#comments</comments>
		<pubDate>Fri, 02 Oct 2009 20:33:06 +0000</pubDate>
		<dc:creator>Sean</dc:creator>
				<category><![CDATA[MVC]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://byatool.com/?p=902</guid>
		<description><![CDATA[Just a note, this is kind of an add on to this post but it's a much more simple (HOSTED) example and also deals with doing the whole check box thing with jQuery. So one of the things I ran into some what recently was a grid... a grid with a death wish and a [...]]]></description>
			<content:encoded><![CDATA[<p>Just a note, this is kind of an add on <a href="http://byatool.com/index.php/mvc/asp-net-mvc-multiple-checkboxes-and-strongly-typed-views/">to this post</a> but it's a much more simple (HOSTED) example and also deals with doing the whole check box thing with jQuery.</p>
<p>So one of the things I ran into some what recently was a grid... a grid with a death wish and a thirst for revenge. It also has a bunch of check boxes to allow multiple row deletes as seen here:</p>
<pre><img src="http://www.iamwebproject.com/PhotoView/Photo/ShowPhoto/13" alt="TURN YOUR IMAGES ON" /></pre>
<p>Now there might be a moment of panic and doubt (Or doubt and panic, everyone reacts differently) when you realize you no longer have those cushy grid postback events. WHAT ARE YOU GOING TO DO???? Well first you're going to feel disgust over your profuse sweating, cause lets be honest you're pretty gross. Then you're going to read on and find that all your panic, fun as it can be, was for nothing. Why? Because you have me... and not in some weird love kind of way because I don't even know you. More of a "You can count on me because I'm like that cool older brother you never had and because of which you ended up a social degenerate ie a programmer" kind of way.</p>
<p>Now to start I've already hosted both the code and a working example:</p>
<p><a href="http://www.iamwebproject.com/IdList/Test/CheckForIds/">Actual running thing on teh webz.</a></p>
<p><a href="http://www.iamwebproject.com/BAT/IdListLive.zip">Hosted code</a></p>
<p>Because I'm such a nice guy. (And that's true, I can list at least five people who aren't my mom who can attest to that.) However, I wouldn't be the nice guy that I am if I weren't going to at least explain some of the code.</p>
<p>There are two ways I handle this situation in the example I hosted, one is with a form, action, and post back. The other is with jquery and an asynchronous call. Both are actually pretty easy to pull off.</p>
<p>First let's look at the post back version. The mark up looks a little somethin' like dis:</p>
<pre>  &lt;<span style="color: #800000;">form</span> <span style="color: #ff0000;">action</span><span style="color: #0000ff;">="/Test/CheckForIds/"</span> <span style="color: #ff0000;">method</span><span style="color: #0000ff;">="post"</span>&gt;
    &lt;<span style="color: #800000;">div</span>&gt;
      &lt;<span style="color: #800000;">input</span> <span style="color: #ff0000;">type</span><span style="color: #0000ff;">="checkbox"</span> <span style="color: #ff0000;">name</span><span style="color: #0000ff;">="IdList"</span> <span style="color: #ff0000;">value</span><span style="color: #0000ff;">="1"</span>  /&gt;
      &lt;<span style="color: #800000;">input</span> <span style="color: #ff0000;">type</span><span style="color: #0000ff;">="checkbox"</span> <span style="color: #ff0000;">name</span><span style="color: #0000ff;">="IdList"</span> <span style="color: #ff0000;">value</span><span style="color: #0000ff;">="2"</span> /&gt;
      &lt;<span style="color: #800000;">input</span> <span style="color: #ff0000;">type</span><span style="color: #0000ff;">="checkbox"</span> <span style="color: #ff0000;">name</span><span style="color: #0000ff;">="IdList"</span> <span style="color: #ff0000;">value</span><span style="color: #0000ff;">="3"</span> /&gt;
      &lt;<span style="color: #800000;">input</span> <span style="color: #ff0000;">type</span><span style="color: #0000ff;">="checkbox"</span> <span style="color: #ff0000;">name</span><span style="color: #0000ff;">="IdList"</span> <span style="color: #ff0000;">value</span><span style="color: #0000ff;">="4"</span> /&gt;
    &lt;/<span style="color: #800000;">div</span>&gt;
    &lt;<span style="color: #800000;">div</span>&gt;
      &lt;<span style="color: #800000;">input</span> <span style="color: #ff0000;">type</span><span style="color: #0000ff;">="submit"</span> <span style="color: #ff0000;">value</span><span style="color: #0000ff;">="go"</span> /&gt;
    &lt;/<span style="color: #800000;">div</span>&gt;
  &lt;/<span style="color: #800000;">form</span>&gt;</pre>
<p>Looks like your standard form and if you've used MVC at all, you should be used to seeing something like that. The only thing of interest is that the checkboxes don't have ids and do share the same name. There's a good reason for the second one. Here's the action method:</p>
<pre>  [<span style="color: #008080;">AcceptVerbs</span>(<span style="color: #008080;">HttpVerbs</span>.Post)]
  <span style="color: #0000ff;">public</span> <span style="color: #008080;">ActionResult</span> CheckForIds(<span style="color: #008080;">Int32</span>[] idList)
  {
     <span style="color: #0000ff;">return</span> View(idList);
  }</pre>
<p>Now it makes more sense, doesn't it? The name attribute on the checkbox directly corresponds to the name of the array parameter. THAT'S AMAZING!!!1 Actually, kidding aside it is kind of nice. Not only does it match the checkboxes to the parameter, it also treats the values of the checkboxes (Checked ones) as a list of integers. Pretty slick.</p>
<p>And honestly, that's about all it takes for traditional posting.</p>
<p>Now for the jQuery part:</p>
<pre>  &lt;<span style="color: #800000;">div</span>&gt;
    &lt;<span style="color: #800000;">input</span> <span style="color: #ff0000;">type</span><span style="color: #0000ff;">="checkbox"</span> <span style="color: #ff0000;">name</span><span style="color: #0000ff;">="JqueryIdList"</span> <span style="color: #ff0000;">value</span><span style="color: #0000ff;">="1"</span>  /&gt;
    &lt;<span style="color: #800000;">input</span> <span style="color: #ff0000;">type</span><span style="color: #0000ff;">="checkbox"</span> <span style="color: #ff0000;">name</span><span style="color: #0000ff;">="JqueryIdList"</span> <span style="color: #ff0000;">value</span><span style="color: #0000ff;">="2"</span> /&gt;
    &lt;<span style="color: #800000;">input</span> <span style="color: #ff0000;">type</span><span style="color: #0000ff;">="checkbox"</span> <span style="color: #ff0000;">name</span><span style="color: #0000ff;">="JqueryIdList"</span> <span style="color: #ff0000;">value</span><span style="color: #0000ff;">="3"</span> /&gt;
    &lt;<span style="color: #800000;">input</span> <span style="color: #ff0000;">type</span><span style="color: #0000ff;">="checkbox"</span> <span style="color: #ff0000;">name</span><span style="color: #0000ff;">="JqueryIdList"</span> <span style="color: #ff0000;">value</span><span style="color: #0000ff;">="4"</span> /&gt;
  &lt;/<span style="color: #800000;">div</span>&gt;
  &lt;<span style="color: #800000;">div</span> <span style="color: #ff0000;">onclick</span><span style="color: #0000ff;">="getIds('JqueryIdList');"</span>&gt;
    CLICK
  &lt;/<span style="color: #800000;">div</span>&gt;</pre>
<p>Wow, looks about the same. Go figure. Well that's pretty much because the way hard part is the javascript itself.</p>
<pre>  <span style="color: #0000ff;">function</span> getIds(checkList)
  {
    <span style="color: #0000ff;">var</span> idList = <span style="color: #0000ff;">new</span> <span style="color: #008080;">Array</span>();
    <span style="color: #0000ff;">var</span> loopCounter = 0;
    <span style="color: #008000;">//find all the checked checkboxes</span>
    jQuery(<span style="color: #800000;">"input[name="</span> + checkList + <span style="color: #800000;">"]:checked"</span>).each
    (
      <span style="color: #0000ff;">function</span>()
      {
        <span style="color: #008000;">//fill the array with the values</span>
        idList[loopCounter] = jQuery(<span style="color: #0000ff;">this</span>).val();
        loopCounter += 1;
      }
    );
    <span style="color: #008000;">//Send the list off</span>
    jQuery.getJSON(<span style="color: #800000;">"/Test/CheckForIdsJson/"</span>, { idList: idList }, idsGotten);
  }</pre>
<p>Ok maybe it wasn't that hard or hard at all. But um... And here's the action method:</p>
<pre>  [<span style="color: #008080;">AcceptVerbs</span>(<span style="color: #008080;">HttpVerbs</span>.Get)]
  <span style="color: #0000ff;">public</span> <span style="color: #008080;">ActionResult</span> CheckForIdsJson(<span style="color: #008080;">Int32</span>[] idList)
  {
    <span style="color: #008080;">JsonResult</span> <span style="color: #000000;">result</span> = <span style="color: #0000ff;">new</span> <span style="color: #008080;">JsonResult</span>();
    result.Data = idList;

    <span style="color: #0000ff;">return</span> result;
  }</pre>
<p>So again, the same signature. Amazing huh?</p>
<p>Side note:</p>
<p>When I was eating this morning in front of the television (Chocolate shredded mini wheats if you must know.) I came upon the good ole classic Iron Eagle. I never really thought about how utterly f-ing insane that movie was until now though, mostly because I haven't seen it since I was a kid. I guess back then I could completely buy into the idea of some 17 year old, who can't make it into the Air Force Academy, suiting up and learning to use (At the time) the most complicated fighter the US had to offer within what? one whole montage, steal a 18 million dollar plane (Planes were cheap back then), fly into crazy dangerous territory, get past who knows how many trained professionals, save his dad, and nothing really comes of it. Actually I think if I remember (as I didn't get to watch the whole thing this time) he gets a place in the academy from this. IT'S A COMPLETELY BELIEVABLE STORY! The best part about it is that apparently between the time of the first and second movie his skills had depleted so fast that he gets popped at the beginning of the second one.  I guess without the Saving Dad mojo, he's just not the same.  Tip your glass to good ole Thumper.</p>
<p>I really miss the 80s where movies didn't really need to make any sense as long as they had some soundtrack filled with crazy obscure bands playing at random times in the movies itself followed by the movie characters commenting how great the music is.</p>
<div  class="related_post_title">Related Posts</div><ul class="related_post"><li><a href="http://byatool.com/writing/byatool-com-gets-a-shiny-new-tool/" title="ByATool.com gets a shiny new tool!">ByATool.com gets a shiny new tool!</a></li><li><a href="http://byatool.com/lessons/child-iframe-page-interacting-with-parent-page-yeah-i-went-there/" title="Child IFrame Page Interacting with Parent Page&#8230; Yeah I went there.">Child IFrame Page Interacting with Parent Page&#8230; Yeah I went there.</a></li><li><a href="http://byatool.com/lessons/get-the-jquery-datepicker-to-work-with-jquery-modal-dialog/" title="Get the jQuery DatePicker to Work With jQuery Modal Dialog">Get the jQuery DatePicker to Work With jQuery Modal Dialog</a></li><li><a href="http://byatool.com/ui/jquery-modal-dialog-hide-that-stupid-x-button-windows-close-button/" title="jQuery Modal Dialog : Hide That Stupid X Button / Windows Close Button">jQuery Modal Dialog : Hide That Stupid X Button / Windows Close Button</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://byatool.com/mvc/asp-net-mvc-how-to-handle-multiple-checkboxes-with-viewsactions-jquery-too/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>ASP.Net MVC:  Show Picture Dynamically Using jQuery</title>
		<link>http://byatool.com/mvc/asp-net-mvc-show-picture-dynamically-using-jquery/</link>
		<comments>http://byatool.com/mvc/asp-net-mvc-show-picture-dynamically-using-jquery/#comments</comments>
		<pubDate>Tue, 08 Sep 2009 13:25:51 +0000</pubDate>
		<dc:creator>Sean</dc:creator>
				<category><![CDATA[MVC]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://byatool.com/?p=886</guid>
		<description><![CDATA[Ready for the next step to this guy? Can't sleep lately because of it? Ignoring your day to day tasks due to anticipation? Well wait no longer. I have just the cure for you. In fact, steady use has shown to improve both self esteem and popularity. Behold Jquepictuax: function showPicture(imageHolder, id) { jQuery(imageHolder).attr("src", "/Photo/ShowPhoto/" [...]]]></description>
			<content:encoded><![CDATA[<p>Ready for the next step to <a href="http://byatool.com/index.php/mvc/asp-net-mvc-upload-image-to-database-and-show-image-dynamically-using-a-view/">this guy?</a> Can't sleep lately because of it? Ignoring your day to day tasks due to anticipation? Well wait no longer. I have just the cure for you. In fact, steady use has shown to improve both self esteem and popularity. Behold Jquepictuax:</p>
<pre><span style="color: #0000ff;">function</span> showPicture(imageHolder, id)
{
  jQuery(imageHolder).attr(<span style="color: #800000;">"src"</span>, <span style="color: #800000;">"/Photo/ShowPhoto/"</span> + id);
}</pre>
<p>And you can't forget to try:</p>
<pre>&lt;<span style="color: #800000;">img</span> <span style="color: #ff0000;">id</span><span style="color: #0000ff;">="holder"</span> <span style="color: #ff0000;">alt</span><span style="color: #0000ff;">=""</span> /&gt;
&lt;<span style="color: #800000;">div</span> <span style="color: #ff0000;">onclick</span><span style="color: #0000ff;">="showPicture('#holder', '79');"</span>&gt;Show!&lt;/<span style="color: #800000;">div</span>&gt;</pre>
<p>And with that your life will be far better than it was before. You can once again start enjoying the simple things in life. Enjoy the birds singing, the sun setting, and those noisy little things that run around your house.<br />
<small><br />
Disclaimer: Id may vary. Image results also very. Though proven to be better when tested again a placebo, Jquepictuax may not improve your self esteem or make you more popular. Jquepictuax is not guaranteed to improve your life in any way. Use Jquepictuax in small quantities. People with low blood pressure or who are pregnant should avoid using Jquepictuax. If you consume more than 3 alcoholic drinks per day, please seek medical attention before use. May cause certain side effects such as dizziness, nausea, overwhelming chills, headaches, muscle soreness, dry mouth, light headedness, sleepiness, drop in appetite, and death. If you notice any these side effects, stop use of Jquepictuax immediately and seek medical attention. Please consult physician before Jquepictuax use.<br />
</small><br />
You happiness is right around the corner, why not turn it with Jquepictuax?</p>
<div  class="related_post_title">Related Posts</div><ul class="related_post"><li><a href="http://byatool.com/writing/byatool-com-gets-a-shiny-new-tool/" title="ByATool.com gets a shiny new tool!">ByATool.com gets a shiny new tool!</a></li><li><a href="http://byatool.com/lessons/child-iframe-page-interacting-with-parent-page-yeah-i-went-there/" title="Child IFrame Page Interacting with Parent Page&#8230; Yeah I went there.">Child IFrame Page Interacting with Parent Page&#8230; Yeah I went there.</a></li><li><a href="http://byatool.com/lessons/get-the-jquery-datepicker-to-work-with-jquery-modal-dialog/" title="Get the jQuery DatePicker to Work With jQuery Modal Dialog">Get the jQuery DatePicker to Work With jQuery Modal Dialog</a></li><li><a href="http://byatool.com/ui/jquery-modal-dialog-hide-that-stupid-x-button-windows-close-button/" title="jQuery Modal Dialog : Hide That Stupid X Button / Windows Close Button">jQuery Modal Dialog : Hide That Stupid X Button / Windows Close Button</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://byatool.com/mvc/asp-net-mvc-show-picture-dynamically-using-jquery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>To Async or Not To Async&#8230; That is the ReWritten Cliche Quote.</title>
		<link>http://byatool.com/pontification/to-async-or-not-to-async-that-is-the-rewritten-cliche-quote/</link>
		<comments>http://byatool.com/pontification/to-async-or-not-to-async-that-is-the-rewritten-cliche-quote/#comments</comments>
		<pubDate>Thu, 27 Aug 2009 18:48:35 +0000</pubDate>
		<dc:creator>Sean</dc:creator>
				<category><![CDATA[Pontification]]></category>
		<category><![CDATA[Asynchronous Operations]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://byatool.com/?p=870</guid>
		<description><![CDATA[One of the things I've been wondering as a of late, besides why Micheal Bay still is allowed to make movies... and no money is NOT and excuse, is whether it's better to just load and entire page and hide/show stuff on some click OR only load what's shown and have said click handle loading [...]]]></description>
			<content:encoded><![CDATA[<p>One of the things I've been wondering as a of late, besides why Micheal Bay still is allowed to make movies... and no money is NOT and excuse, is whether it's better to just load and entire page and hide/show stuff on some click OR only load what's shown and have said click handle loading the stuff through Asynchronous Calls and Json.</p>
<p>I bet that made sense!</p>
<p>Here's the situation, I have a blog thing I'm working on and it allows for multiple blogs per site. The "splash" page, if you will, looks like this:</p>
<pre><img class="alignnone size-full wp-image-872" title="BAT_BlogSplash1" src="http://byatool.com/wp-content/uploads/2009/08/BAT_BlogSplash1.PNG" alt="BAT_BlogSplash1" width="611" height="658" /></pre>
<p>And when you click "Newest" it looks like this:</p>
<pre><img class="alignnone size-full wp-image-873" title="BAT_BlogSplash2" src="http://byatool.com/wp-content/uploads/2009/08/BAT_BlogSplash2.PNG" alt="BAT_BlogSplash2" width="845" height="658" /></pre>
<p>As you can see, Newest brings up a pop out div thing that shows the latest post.</p>
<blockquote><p>Side note, I was going to have it just show the first X characters of the post as a teaser, but turns out that if there is any broken HTML because of that, IT'S A HUGE PAIN TO FIX. Something like &lt;div&gt; this is something that &lt;di... OH SNAP THE DIV IS BROKEN! ALERT! ALERT! So this was a "solution".</p></blockquote>
<p>Originally I had it loading the needed post in it's respective pop out div and just hiding all of them. Then it would show the post when the Newest "button" was clicked. Then it dawned on me that this might be silly since only one is going to be open at a time. Why send the client a ton of unneeded html? So, I moved on to using jQuery/Json to grab the needed post data when the Newest "button" is clicked. Then I just populate the pop out div with the returned information as it opens... or whenever it gets back to the client. Can't always assume it will be there immediately. Interweb can be slow at times.</p>
<p>Anyways, this brings up an issue: Am I better off with the first or second solution? Given that all things are equal, it seems like a better idea to have the jQuery solution due to the fact you aren't sending useless html to the client. This will most definitely help with initial load time for the client. Only problem is, that jQuery method is run every time one of the Newest "buttons" is pressed meaning you could have an infinite amount of requests per person. I suppose this is a matter of gambling really.</p>
<p><strong>Do I go with full html and because I assume the user will look at all the latest posts anyhow and therefore cut down the needed requests?</strong></p>
<p><strong>Do I go with the jQuery method because more often than not, users will not look at all the latest posts OR at least will take some time in between the Newest "button" pressing so that it's ok there might be a ton of requests over time?</strong></p>
<p>At this point I think the second is the way to go, but it's most likely situational. Time will tell.</p>
<div  class="related_post_title">Related Posts</div><ul class="related_post"><li><a href="http://byatool.com/writing/byatool-com-gets-a-shiny-new-tool/" title="ByATool.com gets a shiny new tool!">ByATool.com gets a shiny new tool!</a></li><li><a href="http://byatool.com/lessons/child-iframe-page-interacting-with-parent-page-yeah-i-went-there/" title="Child IFrame Page Interacting with Parent Page&#8230; Yeah I went there.">Child IFrame Page Interacting with Parent Page&#8230; Yeah I went there.</a></li><li><a href="http://byatool.com/lessons/get-the-jquery-datepicker-to-work-with-jquery-modal-dialog/" title="Get the jQuery DatePicker to Work With jQuery Modal Dialog">Get the jQuery DatePicker to Work With jQuery Modal Dialog</a></li><li><a href="http://byatool.com/ui/jquery-modal-dialog-hide-that-stupid-x-button-windows-close-button/" title="jQuery Modal Dialog : Hide That Stupid X Button / Windows Close Button">jQuery Modal Dialog : Hide That Stupid X Button / Windows Close Button</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://byatool.com/pontification/to-async-or-not-to-async-that-is-the-rewritten-cliche-quote/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>jQuery Whack-A-Mole&#8230; Timer, Hide, Slide, and Fun</title>
		<link>http://byatool.com/ui/jquery-whack-a-mole-timer-hide-slide-and-fun/</link>
		<comments>http://byatool.com/ui/jquery-whack-a-mole-timer-hide-slide-and-fun/#comments</comments>
		<pubDate>Tue, 18 Aug 2009 14:12:16 +0000</pubDate>
		<dc:creator>Sean</dc:creator>
				<category><![CDATA[UI]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Stupid]]></category>

		<guid isPermaLink="false">http://byatool.com/?p=857</guid>
		<description><![CDATA[So I'll just straight up file this under "I really shouldn't have" and not bother asking for forgiveness. For some reason I had it in my mind I wanted to see if I could take the stuff I learned from this guy and this guy and see if I could make a simple Whack A [...]]]></description>
			<content:encoded><![CDATA[<p>So I'll just straight up file this under "I really shouldn't have" and not bother asking for forgiveness.  For some reason I had it in my mind I wanted to see if I could take the stuff I learned from <a href="http://byatool.com/index.php/ui/jquery-slide-menu-with-pop-up-divs-yay/">this guy</a> and <a href="http://byatool.com/index.php/ui/jquery-slide-and-pairing-a-divs-hover-with-a-divs-slide/">this guy</a> and see if I could make a simple Whack A Mole game with just jquery and the three include files. (jquery, jquery UI, and jquery Timer)  Not thinking of the massive consequences such a thing might bring, I pushed on in the name of science.  </p>
<p>So with no further build up or stupidity (I used that all up in building this game) I give you <a href="http://www.byatool.com/Hosted/LiveDemos/WhackAMole/WhackAMole.htm">jQuery WHACK A MOLE</a> which oddly enough has somehow clawed it's way into my <a href="http://www.iamwebproject.com/BAT/WhackAMole.zip">hosting here.</a>  So if you're foolish enough to actually want to know how it works, there are plenty of comments in the script files.  Just don't blame me for any loss of intelligence.</p>
<p>I might actually take this to the next horrifying level and make it an mvc application.  Not sure I... no... THE WORLD can take it.</p>
<div  class="related_post_title">Related Posts</div><ul class="related_post"><li><a href="http://byatool.com/writing/byatool-com-gets-a-shiny-new-tool/" title="ByATool.com gets a shiny new tool!">ByATool.com gets a shiny new tool!</a></li><li><a href="http://byatool.com/lessons/child-iframe-page-interacting-with-parent-page-yeah-i-went-there/" title="Child IFrame Page Interacting with Parent Page&#8230; Yeah I went there.">Child IFrame Page Interacting with Parent Page&#8230; Yeah I went there.</a></li><li><a href="http://byatool.com/lessons/get-the-jquery-datepicker-to-work-with-jquery-modal-dialog/" title="Get the jQuery DatePicker to Work With jQuery Modal Dialog">Get the jQuery DatePicker to Work With jQuery Modal Dialog</a></li><li><a href="http://byatool.com/ui/jquery-modal-dialog-hide-that-stupid-x-button-windows-close-button/" title="jQuery Modal Dialog : Hide That Stupid X Button / Windows Close Button">jQuery Modal Dialog : Hide That Stupid X Button / Windows Close Button</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://byatool.com/ui/jquery-whack-a-mole-timer-hide-slide-and-fun/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery: Slide Menu With Pop Up Divs.  Yay!</title>
		<link>http://byatool.com/ui/jquery-slide-menu-with-pop-up-divs-yay/</link>
		<comments>http://byatool.com/ui/jquery-slide-menu-with-pop-up-divs-yay/#comments</comments>
		<pubDate>Mon, 17 Aug 2009 20:48:30 +0000</pubDate>
		<dc:creator>Sean</dc:creator>
				<category><![CDATA[UI]]></category>
		<category><![CDATA[Dynamic Controls]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://byatool.com/?p=851</guid>
		<description><![CDATA[So you may have seen this post about how I came to create such a wonderful menu with no real purpose as of yet. Well that menu has been improved and can be downloaded here. Remember that question you never asked? Well once again I've answered it. To take the normal sliding menu farther I [...]]]></description>
			<content:encoded><![CDATA[<p>So you may have seen <a href="http://byatool.com/index.php/ui/jquery-slide-menu-another-cause-i-can-experiment/">this post</a> about how I came to create such a wonderful menu with no real purpose as of yet. Well that <a href="http://byatool.com/Hosted/LiveDemos/SlideMenuHoverDivs/SlideMenuHoverDivs.htm">menu has been improved</a> and can be <a href="http://iamwebproject.com/BAT/SlideMenuHoverDivs.zip">downloaded here</a>.</p>
<p>Remember that question you never asked? Well once again I've answered it.</p>
<p>To take the normal sliding menu farther I thought I should have something happen when hovering over the menu items. Novel! Well as you can see if you clicked on the link above (Sorry, can't repost the link. Links are expensive.) the menu items have large counter parts that show up when hovered over and don't go away until the counter part or the main item is left. What does this all mean? I DON'T KNOW but I'll find out eventually. It's in the cards man, it's in the cards...</p>
<p>Ok so additions... For the style sheet, I added a class:</p>
<pre><span style="color: #800000;">.menuItemBig
</span>{
  <span style="color: #ff0000;">height</span>:<span style="color: #0000ff;">100px</span>;
  <span style="color: #ff0000;">margin</span><span style="color: #ff0000;">-right</span>:<span style="color: #0000ff;">5px</span>;
  <span style="color: #ff0000;">position</span>:<span style="color: #0000ff;">absolute</span>;
  <span style="color: #ff0000;">width</span>:<span style="color: #0000ff;">100px</span>;
  <span style="color: #ff0000;">z-index</span>:<span style="color: #0000ff;">100</span>;
}</pre>
<p>And have included a child div to the menu item:</p>
<p><strong>Before</strong></p>
<pre>  &lt;<span style="color: #800000;">div</span> <span style="color: #ff0000;">class</span><span style="color: #0000ff;">="menuItem</span> <span style="color: #0000ff;">floatLeft</span> <span style="color: #0000ff;">blue</span>"&gt;1&lt;/<span style="color: #800000;">div</span>&gt;</pre>
<p><strong>Now</strong></p>
<pre>  &lt;<span style="color: #800000;">div</span> <span style="color: #ff0000;">class</span><span style="color: #0000ff;">="menuItem floatLeft blue"</span>&gt;
    1
    &lt;<span style="color: #800000;">div</span> <span style="color: #ff0000;">class</span><span style="color: #0000ff;">="menuItemBig red"</span>&gt;THIS IS THE BIG ITEM 1&lt;/<span style="color: #800000;">div</span>&gt;
  &lt;/<span style="color: #800000;">div</span>&gt;</pre>
<p>I added two methods:</p>
<pre><span style="color: #008000;">//
</span><span style="color: #008000;">// mouseenter: Find any menuItemBig within the given element and show</span>
<span style="color: #008000;">//             Reset the position of the menuItemBig element to appear</span>
<span style="color: #008000;">//             to be in the middle of the parent element</span>
<span style="color: #008000;">// mouseleave: Hide the child menuItemBig</span>
<span style="color: #008000;">//</span>
<span style="color: #0000ff;">function</span> setOnHoverForMenuItems(items)
{
  jQuery(items)
  .each
  (
    <span style="color: #0000ff;">function</span> ()
    {
      jQuery(<span style="color: #0000ff;">this</span>).mouseenter
      (
        <span style="color: #0000ff;">function</span>()
        {
          <span style="color: #008000;">//Why the positioning?  I wanted the child div to show up in the</span>
          <span style="color: #008000;">// middle of the parent div which is done by putting the child's left side</span>
          <span style="color: #008000;">// to half of the width of the parent over from the parent's left side</span>
          <span style="color: #0000ff;">var</span> parentPosition = jQuery(<span style="color: #0000ff;">this</span>).position();
          <span style="color: #0000ff;">var</span> bigItems = jQuery(<span style="color: #0000ff;">this</span>).children(<span style="color: #800000;">".menuItemBig"</span>);
          bigItems.css({ left: parentPosition.left - (jQuery(<span style="color: #0000ff;">this</span>).width() /2), top: parentPosition.top + 10  });
          bigItems.show();
        }
      );

      jQuery(<span style="color: #0000ff;">this</span>).mouseleave
      (
        <span style="color: #0000ff;">function</span>()
        {
          jQuery(<span style="color: #0000ff;">this</span>).children(<span style="color: #800000;">".menuItemBig"</span>).hide();
        }
      );
    }
  );
}</pre>
<p>Why not hover? *EDIT* It should be hover.  Turns out an issue I was having with hover was not actually an issue with it...  *END EDIT*</p>
<p>The other method I added was a simple one:</p>
<pre><span style="color: #008000;">//</span>
<span style="color: #008000;">// Used to find any element of menuItemBig</span>
<span style="color: #008000;">//</span>
<span style="color: #0000ff;">function</span> hideAllBigItems(bigItemParentItems)
{
  jQuery(bigItemParentItems).children(<span style="color: #800000;">".menuItemBig"</span>).hide();
}</pre>
<p>And where did I use these? I appended them to the setChildrenDivs method:</p>
<pre><span style="color: #0000ff;">function</span> setChildrenDivs(mainHolder)
{
  <span style="color: #0000ff;">var</span> menuItems = getMenuItems(mainHolder);

  <span style="color: #0000ff;">for</span> (var loopCounter = 0; loopCounter &lt; menuItems.length; loopCounter++)
  {
    <span style="color: #0000ff;">if</span>(loopCounter &gt; maximumToShow - 1)
    {
      jQuery(menuItems[loopCounter]).hide();
    }
  }

  setPager(jQuery(mainHolder).children(<span style="color: #800000;">".leftPager"</span>), getLastVisible, getNextInLineBack);
  setPager(jQuery(mainHolder).children(<span style="color: #800000;">".rightPager"</span>),getFirstVisible, getNextInLineFront);
  <span style="color: #ff0000;">setOnHoverForMenuItems(menuItems);</span>
  <span style="color: #ff0000;">hideAllBigItems(menuItems);</span>
}</pre>
<p>So in all, this didn't take much at all, thanks to mouseleave. Next up... not sure. No idea if I will take this any further.</p>
<div  class="related_post_title">Related Posts</div><ul class="related_post"><li><a href="http://byatool.com/writing/byatool-com-gets-a-shiny-new-tool/" title="ByATool.com gets a shiny new tool!">ByATool.com gets a shiny new tool!</a></li><li><a href="http://byatool.com/lessons/child-iframe-page-interacting-with-parent-page-yeah-i-went-there/" title="Child IFrame Page Interacting with Parent Page&#8230; Yeah I went there.">Child IFrame Page Interacting with Parent Page&#8230; Yeah I went there.</a></li><li><a href="http://byatool.com/lessons/get-the-jquery-datepicker-to-work-with-jquery-modal-dialog/" title="Get the jQuery DatePicker to Work With jQuery Modal Dialog">Get the jQuery DatePicker to Work With jQuery Modal Dialog</a></li><li><a href="http://byatool.com/ui/jquery-modal-dialog-hide-that-stupid-x-button-windows-close-button/" title="jQuery Modal Dialog : Hide That Stupid X Button / Windows Close Button">jQuery Modal Dialog : Hide That Stupid X Button / Windows Close Button</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://byatool.com/ui/jquery-slide-menu-with-pop-up-divs-yay/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery Slide Menu&#8230;  Another Cause I Can Experiment</title>
		<link>http://byatool.com/ui/jquery-slide-menu-another-cause-i-can-experiment/</link>
		<comments>http://byatool.com/ui/jquery-slide-menu-another-cause-i-can-experiment/#comments</comments>
		<pubDate>Tue, 11 Aug 2009 17:00:41 +0000</pubDate>
		<dc:creator>Sean</dc:creator>
				<category><![CDATA[UI]]></category>
		<category><![CDATA[Dynamic]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Menu]]></category>

		<guid isPermaLink="false">http://byatool.com/?p=827</guid>
		<description><![CDATA[So for no real reason at all I had it in my mind that I wanted to make a horizontal menu with jQuery that would work like that weird scrolling menu thing that Macs have. No idea what it's called. So basically I don't need it, have no reason for it, but damnit I'm going [...]]]></description>
			<content:encoded><![CDATA[<p>So for no real reason at all I had it in my mind that I wanted to make a horizontal menu with jQuery that would work like that weird scrolling menu thing that Macs have.  No idea what it's called.  So basically I don't need it, have no reason for it, but damnit I'm going to make it happen and I did it with only 3 things from <a href="http://www.jquery.com">jquery.com</a>; 1.3.2, ui 1.7.2, and jquery.timer . Now this is still rough in the sense it has no real styling but it works tried and true functionality wise.</p>
<p>The main idea is that there are two scroll arrows, one on each side, and X amount of divs. Now at the start, a certain amount of divs are hidden (global variable). When hovering over the left pager, for example, it causes one on the right to hide while one on the left appears giving the feeling of the items sliding.</p>
<p><a href="http://www.byatool.com/Hosted/LiveDemos/SlideMenu/SlideMenu.htm">EXAMPLE HERE!!11</a></p>
<p>The markup is simple, a holder with x number of elements that are "menuitems" and two pager divs.</p>
<pre>&lt;<span style="color: #800000;">div</span> <span style="color: #ff0000;">class</span><span style="color: #0000ff;">="mainHolder"</span>&gt;
  &lt;<span style="color: #800000;">div</span> <span style="color: #ff0000;">class</span><span style="color: #0000ff;">="leftPager green floatLeft"</span>&gt;&lt;&lt;/<span style="color: #800000;">div</span>&gt;
  &lt;<span style="color: #800000;">div</span> <span style="color: #ff0000;">class</span><span style="color: #0000ff;">="menuItem floatLeft blue"</span>&gt;1&lt;/<span style="color: #800000;">div</span>&gt;
  &lt;<span style="color: #800000;">div</span> <span style="color: #ff0000;">class</span><span style="color: #0000ff;">="menuItem floatLeft red"</span>&gt;2&lt;/<span style="color: #800000;">div</span>&gt;
  &lt;<span style="color: #800000;">div</span> <span style="color: #ff0000;">class</span><span style="color: #0000ff;">="menuItem floatLeft yellow"</span>&gt;3&lt;/<span style="color: #800000;">div</span>&gt;
  &lt;<span style="color: #800000;">div</span> <span style="color: #ff0000;">class</span><span style="color: #0000ff;">="menuItem floatLeft blue"</span>&gt;4&lt;/<span style="color: #800000;">div</span>&gt;
  &lt;<span style="color: #800000;">div</span> <span style="color: #ff0000;">class</span><span style="color: #0000ff;">="menuItem floatLeft red"</span>&gt;5&lt;/<span style="color: #800000;">div</span>&gt;
  &lt;<span style="color: #800000;">div</span> <span style="color: #ff0000;">class</span><span style="color: #0000ff;">="menuItem floatLeft yellow"</span>&gt;6&lt;/<span style="color: #800000;">div</span>&gt;
  &lt;<span style="color: #800000;">div</span> <span style="color: #ff0000;">class</span><span style="color: #0000ff;">="menuItem floatLeft blue"</span>&gt;7&lt;/<span style="color: #800000;">div</span>&gt;
  &lt;<span style="color: #800000;">div</span> <span style="color: #ff0000;">class</span><span style="color: #0000ff;">="rightPager green floatLeft"</span>&gt;&gt;&lt;/<span style="color: #800000;">div</span>&gt;
&lt;/<span style="color: #800000;">div</span>&gt;</pre>
<p>I think from the classes you can tell what you need to know about them.</p>
<p>First thing we need from jQuery is methods to find various elements in the container when paging.</p>
<pre><span style="color: #008000;">//When using the left pager, it's important to find the first visible element
</span><span style="color: #008000;">//then find the item before it so that it can be shown.</span>
<span style="color: #0000ff;">function</span> getNextInLineBack(menuItems)
{
  <span style="color: #0000ff;">var</span> oneBefore = <span style="color: #0000ff;">null</span>;

  <span style="color: #0000ff;">for</span> (<span style="color: #0000ff;">var</span> loopCounter = 0; loopCounter &lt; menuItems.length; loopCounter++)
  {
    <span style="color: #0000ff;">if</span>(jQuery(menuItems[loopCounter]).is(<span style="color: #ff0000;">":visible"</span>) &amp;&amp; loopCounter &gt; 0)
    {
      oneBefore = jQuery(menuItems[loopCounter - 1 ]);
      <span style="color: #0000ff;">break</span>;
    }
  }

  <span style="color: #0000ff;">return</span> oneBefore;
}

<span style="color: #008000;">//Find the first visible element from the beginning.
</span><span style="color: #008000;">//This will be needed when paging right since it will have to be hidden</span>
<span style="color: #0000ff;">function</span> getFirstVisible(menuItems)
{
  <span style="color: #0000ff;">var</span> firstVisible = <span style="color: #0000ff;">null</span>;

  <span style="color: #0000ff;">for</span> (<span style="color: #0000ff;">var</span> loopCounter = 0; loopCounter &lt; menuItems.length; loopCounter++)
  {
    <span style="color: #0000ff;">if</span>(jQuery(menuItems[loopCounter]).is(<span style="color: #ff0000;">":visible"</span>) &amp;&amp; loopCounter &lt; menuItems.length - maximumToShow)
    {
        firstVisible = menuItems[loopCounter];
        <span style="color: #0000ff;">break</span>;
    }
  }
  <span style="color: #0000ff;">return</span> firstVisible;
} 

<span style="color: #008000;">//Get the last possible visible item
</span><span style="color: #008000;">/</span><span style="color: #008000;">/If the item is in an index less than the maximum number to show, then null is returned since there has to be no more or less than the maximumToShow.
</span><span style="color: #0000ff;">function</span> getLastVisible(menuItems)
{
  <span style="color: #0000ff;">var</span> lastVisible = <span style="color: #0000ff;">null</span>;
  <span style="color: #0000ff;">for</span> (<span style="color: #0000ff;">var</span> loopCounter = menuItems.length - 1; loopCounter &gt; maximumToShow - 1; loopCounter--)
  {
    <span style="color: #0000ff;">if</span>(jQuery(menuItems[loopCounter]).is(<span style="color: #ff0000;">":visible"</span>))
    {
      lastVisible = menuItems[loopCounter];
      <span style="color: #0000ff;">break</span>;
    }
  }

  <span style="color: #0000ff;">return</span> lastVisible;
}

<span style="color: #008000;">//Find the first visible from the end
</span><span style="color: #008000;">//Pretty simple, this will be important when paging left since this</span>
<span style="color: #008000;">//will be the next item to be hidden</span>
<span style="color: #0000ff;">function</span> getNextInLineFront(menuItems)
{
  <span style="color: #0000ff;">var</span> lastOne = <span style="color: #0000ff;">null</span>;

  <span style="color: #0000ff;">for</span> (<span style="color: #0000ff;">var</span> loopCounter = menuItems.length-1; loopCounter &gt; -1; loopCounter--)
  {
    <span style="color: #0000ff;">if</span>(jQuery(menuItems[loopCounter]).is(<span style="color: #ff0000;">":visible"</span>))
    {
      lastOne = menuItems[loopCounter + 1];
      <span style="color: #0000ff;">break</span>;
    }
  }

  <span style="color: #0000ff;">return</span> lastOne;
}</pre>
<p>Next is a method that is just used to stop having to repeat the same thing over and over when needing a list of all the menu items.</p>
<pre><span style="color: #0000ff;">function</span> getMenuItems(mainHolder)
{
  <span style="color: #0000ff;">return</span> jQuery(mainHolder).children(<span style="color: #ff0000;">".menuItem"</span>);
}</pre>
<p>Next is the method to handle what item to show and what item to hide when the pager has the mouse over it. Instead of having methods for the right and left pager, I just ended up having the methods for finding the item to hide and show sent through as parameters.</p>
<pre><span style="color: #0000ff;">function</span> showHideOnHover(pager, timer, getHideMethod, getShowMethod)
{
  <span style="color: #008000;">//This is just candy for changing the color of the pager when the mouse</span>
  <span style="color: #008000;">//is over it</span>
  jQuery(pager).removeClass(<span style="color: #ff0000;">"green"</span>);
  jQuery(pager).addClass(<span style="color: #ff0000;">"orange"</span>);

  <span style="color: #008000;">//Remember those methods I passed through, well here they</span>
  <span style="color: #008000;">//are in use.  I'm using them to get the item to hide and the item</span>
  <span style="color: #008000;">//to show along with the list of items.</span>
  <span style="color: #0000ff;">var</span> menuItems = getMenuItems(jQuery(pager).parent());
  <span style="color: #0000ff;">var</span> hide = getHideMethod(menuItems);
  <span style="color: #0000ff;">var</span> show = getShowMethod(menuItems);

  <span style="color: #008000;">//If neither is null, then go ahead and show/hide</span>
  <span style="color: #008000;">//If either one is null, something isn't right and the timer</span>
  <span style="color: #008000;">//needs to be stopped.... timer??  Well I'll get to that</span>
  <span style="color: #008000;">//next.</span>
  <span style="color: #0000ff;">if</span>(show != <span style="color: #0000ff;">null</span> &amp;&amp; hide != <span style="color: #0000ff;">null</span>)
  {
    jQuery(hide).hide( <span style="color: #ff0000;">"slide"</span>, { direction: <span style="color: #ff0000;">"right"</span> } , 0);
    jQuery(show).show( <span style="color: #ff0000;">"slide"</span>, { direction: <span style="color: #ff0000;">"left"</span> } , 100);
  }
  else
  {
    timer.stop();
  }
}</pre>
<p>Now for the method above the last one, this one involves the timer passed in the last method. This method actually sets the mouseover/mouseout events (aka hover). When mouseover, the timer is created and the showHideOnHover method is called every 500 units, that's we'll call tools, (Not sure how much that is, seems like a half second) after the first time it's called. On mouseout, the timer is stopped, nulled out, and the pager changes it's color.</p>
<pre><span style="color: #0000ff;">function</span> setPager(pager, hideMethod, showMethod)
{
  <span style="color: #008000;">//Making the timer variable "global" to the events so that I know
</span>  <span style="color: #008000;">//I have the same timer for both mouseover and mouseout.</span>
  <span style="color: #0000ff;">var</span> newTimer;
  pager.hover
  (
    <span style="color: #008000;">//Mouseover method
</span>    function()
    {
      var first = true;
      <span style="color: #008000;">//This sets the timer, consequently starting the method for the first time.
</span>      <span style="color: #008000;">//Why timer doesn't have a start method I don't know.  Ask jquery.com.
</span>      <span style="color: #008000;">//The first thing is just so that the first time around it runs right away,
</span>      <span style="color: #008000;">//then each call afterwards comes every 500 tools.
</span>      newTimer = jQuery.timer
                      (
                         0, <span style="color: #008000;">//First time through, runs after 0 tools.</span>
                         function(timer)
                         {
                           showHideOnHover(pager, timer, hideMethod, showMethod);
                           <span style="color: #008000;">//If this is the first time through, reset</span>
                           <span style="color: #008000;">//timer to run every 500 tools.</span>
                           <span style="color: #0000ff;">if</span>(first)
                           {
                              timer.reset(500);
                              first = <span style="color: #0000ff;">false</span>;
                           }
                         }
                       );
    },

    <span style="color: #008000;">//Mouseout method
</span>    <span style="color: #0000ff;">function</span>()
    {
      <span style="color: #008000;">//mouse is done, stop the timer</span>
      newTimer.stop();
      newTimer = <span style="color: #0000ff;">null</span>;
      jQuery(pager).addClass(<span style="color: #ff0000;">"green"</span>);
      jQuery(pager).removeClass(<span style="color: #ff0000;">"orange"</span>)
    }
  );
}</pre>
<p>Now for the method above the one... above. This is used to set the children of the passed in holder.</p>
<pre><span style="color: #0000ff;">function</span> setChildrenDivs(mainHolder)
{
  <span style="color: #008000;">//Get the items for the holder
</span>  <span style="color: #0000ff;">var</span> menuItems = getMenuItems(mainHolder);

  <span style="color: #008000;">//Hide all the items after the first X items (maximumToShow)</span>
  <span style="color: #0000ff;">for</span> (<span style="color: #0000ff;">var</span> loopCounter = 0; loopCounter &lt; menuItems.length; loopCounter++)
  {
    if(loopCounter &gt; maximumToShow - 1)
    {
      jQuery(menuItems[loopCounter]).hide();
    }
  }

  <span style="color: #008000;">//set the pagers.</span>
  setPager(jQuery(mainHolder).children(<span style="color: #ff0000;">".leftPager"</span>), getLastVisible, getNextInLineBack);
  setPager(jQuery(mainHolder).children(<span style="color: #ff0000;">".rightPager"</span>),getFirstVisible, getNextInLineFront);
}</pre>
<p>FINALLY THE END! This is the document.ready method used to set this whole joke in motion. maximumToShow is just how many items to show at a time and is global.</p>
<pre><span style="color: #0000ff;">var</span> maximumToShow = 5;

jQuery(document).ready
(
  <span style="color: #0000ff;">function</span>()
  {
    <span style="color: #008000;">//Find every holder on the page and set everything in motion.
</span>    <span style="color: #0000ff;">var</span> mainHolders = jQuery(<span style="color: #ff0000;">".mainHolder"</span>);
    <span style="color: #0000ff;">for</span> (<span style="color: #0000ff;">var</span> loopCounter = 0; loopCounter &lt; mainHolders.length; loopCounter++)
    {
      setChildrenDivs(mainHolders[loopCounter]);
    }
  }
);</pre>
<p>Why the timer? If you haven't figured that out yet, well it's because I had issues with how to get the menu to keep doing it's thing as long as the user had his/her mouse over a pager. I didn't want this to be a click menu because, let's be honest, that would be much easier. So as is, the timer is started the moment the mouse is over a pager and hides/shows an item. Then every 500 tools the mouse is over the pager, it continues the hide/show until it runs out of items to show/hide. (End of the list)</p>
<p>Uhg that's annoying to type out even with cut and paste so <a href="http://www.iamwebproject.com/BAT/SlideMenu.zip">I will host it here</a>.</p>
<p>I suppose the next part of this would have the items blow up or something when hovering over them but that should be much easier than this was.</p>
<div  class="related_post_title">Related Posts</div><ul class="related_post"><li><a href="http://byatool.com/ui/jquery-slide-and-pairing-a-divs-hover-with-a-divs-slide/" title="jQuery Slide and Pairing a Div&#8217;s Hover With a Div&#8217;s Slide">jQuery Slide and Pairing a Div&#8217;s Hover With a Div&#8217;s Slide</a></li><li><a href="http://byatool.com/ui/aspnet-mvc-jquery-json-and-paging-hows-that-for-a-soe-title/" title="ASP.Net MVC, jQuery, JSon, and paging&#8230;  how&#8217;s that for a SOE title?">ASP.Net MVC, jQuery, JSon, and paging&#8230;  how&#8217;s that for a SOE title?</a></li><li><a href="http://byatool.com/ui/556/" title="jQuery: Add a Pop Up Div to a Link Dynamically">jQuery: Add a Pop Up Div to a Link Dynamically</a></li><li><a href="http://byatool.com/ui/jquery-position-absolute-and-how-to-make-it-all-work/" title="JQuery, Position : Absolute, and How to Make It All Work">JQuery, Position : Absolute, and How to Make It All Work</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://byatool.com/ui/jquery-slide-menu-another-cause-i-can-experiment/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>ASP.Net MVC:  Is the Use of jQuery/Asynchronous calls a Must?</title>
		<link>http://byatool.com/pontification/aspnet-mvc-is-the-use-of-jquery-asynchronous-calls-a-must/</link>
		<comments>http://byatool.com/pontification/aspnet-mvc-is-the-use-of-jquery-asynchronous-calls-a-must/#comments</comments>
		<pubDate>Tue, 28 Jul 2009 20:22:57 +0000</pubDate>
		<dc:creator>Sean</dc:creator>
				<category><![CDATA[Pontification]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[MVC]]></category>

		<guid isPermaLink="false">http://byatool.com/?p=765</guid>
		<description><![CDATA[In this wonderpost, I questioned the use of jQuery in the mind of the purist MVCist. (If that's not a word yet, it is now and I expect royalties.) Now I'll flip it tool style and ask it from another direction: Can MVC survive without jQuery? Here's the situation: I have a site that I [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://byatool.com/index.php/pontification/are-jquery-and-asynchronous-calls-against-mvc/"><span>In this <span>wonderpost</span></span></a><span>, I questioned the use of <span>jQuery</span> in the mind of the purist <span>MVCist</span>. (If that's not a word yet, it is now and I expect royalties.) Now I'll flip it tool style and ask it from another direction: Can MVC survive without <span>jQuery</span>?</span></p>
<p><span>Here's the situation: I have a site that I made a while back (Basically a phone friendly chat room emulator) that was kind of experiment on a couple levels, one being the use of Entity Framework and <span>WebForms</span>. (</span><a href="http://www.eythere.com">It's here if you are curious</a>... right now you have to make an account though. Never got around to allowing non logged in users.) Another part was to see if I could make a multi phone compliant page that had to be fast and work on as many phones as possible. (Anything with a browser at least) And had to be touch friendly. (No links, just buttons)</p>
<p><span>A week back I decided, after trying to make new sites with MVC, to take an existing work and really give MVC a rugged test. <span>Eythere</span> was just that site. Now personally I thought this would be pretty simple since MVC seemed really good at simple, non business sites. What could be more simple than a chat room emulating site that has no javascript? (Aside from whatever Javascript <span>WebForms</span> use for <span>postbacks</span>) I mean in the end, it's just a bunch of buttons right?</span></p>
<p>Yeah turns out what those buttons did was at the heart of my issues. You see, with WebForms, everything done on a page is meant for that page. Sure you can defer how things are handled from the page to another tier, but the action itself belongs to the page. For example, say that a user wanted to make a room a favorite, well there's a button named favorite that he/she clicks to do so.</p>
<pre>
 <img class="alignnone size-full wp-image-766" title="Oh the lovely colors."  src="http://byatool.com/wp-content/uploads/2009/07/bat_chatbox1.png" alt="Oh the lovely colors." width="429" height="222" />
</pre>
<p><span>In <span>webforms</span>, the Room.<span>aspx</span> page would handle the Favorite button click and the current user's favorite list would have the room removed or added depending. But the call to the add/remove would be handled by the button's click event and then the page would be reloaded. Something we in the know call "easy". (Like that word? Use it. It's free because I'm such a nice guy) </span></p>
<p><span>Now with MVC it's a whole new ballpark. With controllers, it becomes of question of what controller should handle this. It could go onto the room controller, but in the end it deals with a user and adding something to the user. So it's fair to say that this is probably a job for Superman if Superman happens to be a <span>UserController</span> or you'll most likely end up repeating code.</span></p>
<p>Now the issue: How is this handled? Whether link or button, something has to be posted to the user controller. Posting to the controller means that the controller, on finish, has to create a model and send it to a view. Well this kind of sucks doesn't it? The user clicks the + Favorite button and bam is taken to a whole new page.</p>
<blockquote><p><strong>SURPRISE IT'S BEEN ADDED TO YOUR FAVORITES! </strong></p></blockquote>
<p><span>Not what I would call fluid. The other thought it to have a redirect, which in the end is more fluid in that it takes the user back to the original page BUT with that you have to send a lot of information back and forth. After all, in MVC a lot of the information for a given "page" is passed using get. So for instance you have a room with a <span>roomid</span> and a page number and a count of items to show and possibly a sort you're looking at:</span></p>
<p>/Room/1/?pageNumber=1&amp;amountToShow=5&amp;sort=Date</p>
<p><span>Which means all of that has to be sent to the User controller in order to save the state, has to be put in session/some kind of user cache, or you just send the entire <span>url</span>. In any case, something has to be tossed around for this to work. More seamless than the other way but it is a lot of work for something so simple.</span></p>
<p><strong>When it comes to ease of UI design, jQuery/asynchronous  operations are a must.</strong></p>
<p><span>Something I think that the MVC idea fails at it in a UI sense it was makes it strong in a programming sense, logical separation of tasks. Right off the bat, I hated the way <span>WebForms</span> handled </span><a href="http://byatool.com/?p=351">AJAX "web methods"</a>. Having to repeat methods per page so they could be "registered" was ugly and a pain. MVC and it's separation/REST ways makes <a href="http://byatool.com/index.php/ui/aspnet-mvc-jquery-json-and-paging-hows-that-for-a-soe-title/"><span><span>asynchronous</span> calls so easy</span></a><span>. However, what used to be a simple operation in <span>WebForms</span> has now become cumbersome without outside help. Straight up, it seems impossible to do non drill down design without using <span>jQuery</span> or some kind of javascript library equivalent without killing the separation that MVC seems to embrace. </span></p>
<p><span>Why is this a problem? For the most part it isn't. Most people aren't going to try something like <span>EyThere</span> (Wouldn't recommend it, it was a pain) since how many people create sites with multiple phones in mind? However, it does serve to show what seems to be a glaring annoyance with MVC. Either use asynchronous calls or just sink.</span></p>
<div  class="related_post_title">Related Posts</div><ul class="related_post"><li><a href="http://byatool.com/writing/byatool-com-gets-a-shiny-new-tool/" title="ByATool.com gets a shiny new tool!">ByATool.com gets a shiny new tool!</a></li><li><a href="http://byatool.com/pontification/asp-net-mvc-quick-overview-of-controller-structure/" title="ASP.Net MVC:  Quick Overview of Controller Structure">ASP.Net MVC:  Quick Overview of Controller Structure</a></li><li><a href="http://byatool.com/pontification/are-jquery-and-asynchronous-calls-against-mvc/" title="Are jQuery and Asynchronous Calls against MVC?">Are jQuery and Asynchronous Calls against MVC?</a></li><li><a href="http://byatool.com/lessons/spark-view-engine-asp-net-mvc-and-you/" title="Spark View Engine, ASP.Net MVC, and You">Spark View Engine, ASP.Net MVC, and You</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://byatool.com/pontification/aspnet-mvc-is-the-use-of-jquery-asynchronous-calls-a-must/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>jQuery Slide and Pairing a Div&#8217;s Hover With a Div&#8217;s Slide</title>
		<link>http://byatool.com/ui/jquery-slide-and-pairing-a-divs-hover-with-a-divs-slide/</link>
		<comments>http://byatool.com/ui/jquery-slide-and-pairing-a-divs-hover-with-a-divs-slide/#comments</comments>
		<pubDate>Fri, 24 Jul 2009 19:19:31 +0000</pubDate>
		<dc:creator>Sean</dc:creator>
				<category><![CDATA[UI]]></category>
		<category><![CDATA[Dynamic]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://byatool.com/?p=749</guid>
		<description><![CDATA[So this could be filed under "I did it because I can" (which is a really good mantra in science...) and am not sure I'll use it but it is useful in the concept. LIVE EXAMPLE HERE The idea is to set the hover on one div to show/hide another div WITHOUT having to use [...]]]></description>
			<content:encoded><![CDATA[<p>So this could be filed under "I did it because I can" (which is a really good mantra in science...) and am not sure I'll use it but it is useful in the concept.</p>
<p><a href="http://www.byatool.com/Hosted/LiveDemos/SlideOnHover/SlideOnHover.htm">LIVE EXAMPLE HERE</a></p>
<p>The idea is to set the hover on one div to show/hide another div WITHOUT having to use some kind of id/name trick (as in setting the id to "divHide1") and to have it be completely self setting in the .ready method. Why would this be at all useful? Say you want to roll through a list of things and generate the divs, but want to defer the jQuery until the page has loaded. And you don't want to have to resort to:</p>
<pre>    <span style="color: #0000ff;">&lt;</span><span style="color: #800000;">div</span> <span style="color: #ff0000;">id</span>="someDiv&lt;%= someId %&gt;"<span style="color: #0000ff;">&gt;</span><span style="color: #0000ff;">&lt;/</span>div<span style="color: #0000ff;">&gt;</span></pre>
<p>like structure where you parse some identifier from the id property. Mostly because you have no idea how many someDiv1s there could be on the page. It could be a highly reused name (someDiv) and that could lead to a mess.</p>
<p>Also the reason 'cuz. If you have any more questions of why after that answer, well you're just being annoying.</p>
<p>Anywho, here's the actual html for structure.</p>
<pre>   <span style="color: #0000ff;">&lt;</span><span style="color: #800000;">div</span> <span style="color: #ff0000;">class</span><span style="color: #0000ff;">="mainDiv"</span><span style="color: #0000ff;">&gt;</span>
      <span style="color: #0000ff;">&lt;</span><span style="color: #800000;">div</span> <span style="color: #ff0000;">class</span><span style="color: #0000ff;">="showDiv"</span> <span style="color: #ff0000;">id</span><span style="color: #0000ff;">="oneTop"&gt;</span>
        Kaneda?
      <span style="color: #0000ff;">&lt;</span><span style="color: #0000ff;">/</span><span style="color: #800000;">div</span><span style="color: #0000ff;">&gt;</span>
      <span style="color: #0000ff;">&lt;</span><span style="color: #800000;">div</span> <span style="color: #ff0000;">class</span><span style="color: #0000ff;">="slideDiv"</span> <span style="color: #ff0000;">id</span><span style="color: #0000ff;">="one"&gt;</span>
        What do you see?!
      <span style="color: #0000ff;">&lt;</span><span style="color: #0000ff;">/</span><span style="color: #800000;">div</span><span style="color: #0000ff;">&gt;</span>
    <span style="color: #0000ff;">&lt;</span><span style="color: #0000ff;">/</span><span style="color: #800000;">div</span><span style="color: #0000ff;">&gt;</span>
    <span style="color: #0000ff;">&lt;</span><span style="color: #800000;">div</span> <span style="color: #ff0000;">class</span><span style="color: #0000ff;">="clear"</span><span style="color: #0000ff;">&gt;&lt;</span><span style="color: #0000ff;">/</span><span style="color: #800000;">div</span><span style="color: #0000ff;">&gt;</span></pre>
<p>Now I get that this isn't off a foreach, but it doesn't take much to figure out that it's easily made into a loop if you just loop it over and over. Why? Because first there are no ids or names so that you can't have two of the same name and also because that chunk is self contained.</p>
<p>So what is going on there? Simple, you have a parent container that holds a div to hold and a div to hover over and the other that will be shown/hidden.</p>
<p>Here's the styles involved just incase you care:</p>
<pre>    <span style="color: #0000ff;">&lt;</span><span style="color: #800000;">style</span> <span style="color: #ff0000;">type</span><span style="color: #0000ff;">="text/css"&gt;</span>
        <span style="color: #800000;">.clear
</span>        {
        	<span style="color: #ff0000;">clear</span>:<span style="color: #0000ff;">both</span>;
        }

        <span style="color: #800000;">.leftDiv</span>
        {
        	<span style="color: #ff0000;">float</span>:<span style="color: #0000ff;">left</span>;
        }

        <span style="color: #800000;">.mainDiv</span>
        {
        	<span style="color: #ff0000;">margin</span>:<span style="color: #0000ff;">5px</span>;
        	<span style="color: #ff0000;">height</span>:<span style="color: #0000ff;">200px</span>;
        }

        <span style="color: #800000;">.rightDiv</span>
        {
        	<span style="color: #ff0000;">float</span>:<span style="color: #0000ff;">left</span>;
        }

        <span style="color: #800000;">.showDiv</span>
        {
        	<span style="color: #ff0000;">float</span>:<span style="color: #0000ff;">left</span>;
        	<span style="color: #ff0000;">margin-right</span>:<span style="color: #0000ff;">5px</span>;
        	<span style="color: #ff0000;">height</span>:<span style="color: #0000ff;">200px</span>;
        	<span style="color: #ff0000;">background-color</span>:<span style="color: #0000ff;">Silver</span>;
        }

        <span style="color: #800000;">.slideDiv</span>
        {
        	<span style="color: #ff0000;">background-color</span>:<span style="color: #0000ff;">Teal</span>;
        	<span style="color: #ff0000;">height</span>:<span style="color: #0000ff;">200px</span>;
        	<span style="color: #ff0000;">position</span>:<span style="color: #0000ff;">absolute</span>;
        	<span style="color: #ff0000;">float</span>:<span style="color: #0000ff;">left</span>;
        	<span style="color: #ff0000;">z-index</span>:<span style="color: #0000ff;">100</span>;
        }
    <span style="color: #0000ff;">&lt;/</span><span style="color: #800000;">style</span><span style="color: #0000ff;">&gt;</span></pre>
<p>That doesn't entirely matter, but it does to show the div "sliding" over another div. Kind of a little somethin' somethin' I threw in at no extra cost. Now for the jQuery:</p>
<p>First the method for setting the mouse over and out events for the show div, we turn to .hover:</p>
<pre>    <span style="color: #0000ff;">function</span> setHover(currentSlideDiv, currentStableDiv)
    {
      currentStableDiv.hover
      (
        <span style="color: #008000;">//first parameter is the method for showing the div on mouse over
</span>        <span style="color: #0000ff;">function</span>()
        {
          if (currentSlideDiv.is(<span style="color: #800000;">":hidden"</span>))
          {
            currentSlideDiv.show(<span style="color: #800000;">"slide"</span>, { direction: <span style="color: #800000;">"left"</span> }, 100);
          }
        },
        <span style="color: #008000;">//second parameter is the method for hiding the div on mouse out
</span>        <span style="color: #0000ff;">function</span>()
        {
          if (currentSlideDiv.is(<span style="color: #800000;">":visible"</span>))
          {
            currentSlideDiv.hide(<span style="color: #800000;">"slide"</span>, { direction: <span style="color: #800000;">"left"</span> }, 100);
          }
        }
      );
    };</pre>
<p>Now for the method that actually uses these:</p>
<pre>    <span style="color: #008000;">//This is used to take in one of the main divs and set all the
</span>    <span style="color: #008000;">//show and slide divs within.</span>
    <span style="color: #0000ff;">function</span> setChildrenDivs(mainDiv)
    {
      <span style="color: #008000;">//get all the show and slide dvis within the main div
</span>      <span style="color: #0000ff;">var</span> mainChildrenStableDiv = jQuery(mainDiv).children(<span style="color: #800000;">".showDiv"</span>);
      <span style="color: #0000ff;">var</span> mainChildrenSlide = jQuery(mainDiv).children(<span style="color: #800000;">".slideDiv"</span>);

      <span style="color: #008000;">//loop through the list of show divs</span>
      <span style="color: #0000ff;">for</span> (<span style="color: #0000ff;">var</span> loopCounter = 0; loopCounter &lt; mainChildrenStableDiv.length; loopCounter++)
      {
        <span style="color: #008000;">//Get the show div and it's corresponding slide div using the
</span>        <span style="color: #008000;">//two lists and the current counter.</span>
        <span style="color: #0000ff;">var</span> currentStableDiv = jQuery(mainChildrenStableDiv[loopCounter]);
        <span style="color: #0000ff;">var</span> currentSlideDiv = jQuery(mainChildrenSlide[loopCounter]);

         <span style="color: #008000;">//This is to make sure the slide is where it should be.
</span>         <span style="color: #008000;">//to the right of the show div.</span>
         <span style="color: #0000ff;">var</span> containerPosition = jQuery(currentStableDiv).position();
         jQuery(currentSlideDiv).css({ left: containerPosition.left + currentStableDiv.width() });
        <span style="color: #008000;">//Set the mouse over and the mouse out on the show div</span>
        setHover(currentSlideDiv, currentStableDiv);
      }
    }</pre>
<p>Now the final touch, the .ready method:</p>
<pre>    jQuery(document).ready
    (
      <span style="color: #0000ff;">function</span>()
      {
        <span style="color: #008000;">//hide all the slide divs
</span>        jQuery(<span style="color: #800000;">".slideDiv"</span>).hide();

        <span style="color: #008000;">//find all the parent divs
</span>        <span style="color: #0000ff;">var</span> mainDivs = jQuery(<span style="color: #800000;">".mainDiv"</span>);

        <span style="color: #008000;">//set the children</span>
        for (var loopCounter = 0; loopCounter &lt; mainDivs.length; loopCounter++)
        {
          setChildrenDivs(mainDivs[loopCounter]);
        }
      }
    );</pre>
<p>And boom, now you have multiple show/hide (Slide in this instance). Now if I could just find a use for it...</p>
<p>Oh yeah and you'll need <a href="http://jquery.com/">jQuery 1.3.2</a> and <a href="http://jqueryui.com/">jQuery ui 1.7.2</a> to use this.  At least those are the versions I know this works with.</p>
<p><strong>Update:  Due to popular demand... one person... <a href="http://www.byatool.com/Hosted/SlideOnHover.zip">Source can be found here.</a></strong></p>
<div  class="related_post_title">Related Posts</div><ul class="related_post"><li><a href="http://byatool.com/ui/jquery-slide-menu-another-cause-i-can-experiment/" title="jQuery Slide Menu&#8230;  Another Cause I Can Experiment">jQuery Slide Menu&#8230;  Another Cause I Can Experiment</a></li><li><a href="http://byatool.com/ui/aspnet-mvc-jquery-json-and-paging-hows-that-for-a-soe-title/" title="ASP.Net MVC, jQuery, JSon, and paging&#8230;  how&#8217;s that for a SOE title?">ASP.Net MVC, jQuery, JSon, and paging&#8230;  how&#8217;s that for a SOE title?</a></li><li><a href="http://byatool.com/ui/556/" title="jQuery: Add a Pop Up Div to a Link Dynamically">jQuery: Add a Pop Up Div to a Link Dynamically</a></li><li><a href="http://byatool.com/ui/jquery-position-absolute-and-how-to-make-it-all-work/" title="JQuery, Position : Absolute, and How to Make It All Work">JQuery, Position : Absolute, and How to Make It All Work</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://byatool.com/ui/jquery-slide-and-pairing-a-divs-hover-with-a-divs-slide/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Are jQuery and Asynchronous Calls against MVC?</title>
		<link>http://byatool.com/pontification/are-jquery-and-asynchronous-calls-against-mvc/</link>
		<comments>http://byatool.com/pontification/are-jquery-and-asynchronous-calls-against-mvc/#comments</comments>
		<pubDate>Thu, 23 Jul 2009 14:42:51 +0000</pubDate>
		<dc:creator>Sean</dc:creator>
				<category><![CDATA[Pontification]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[MVC]]></category>

		<guid isPermaLink="false">http://byatool.com/?p=743</guid>
		<description><![CDATA[This is something I started to think about the other day as I have been diving deeper into MVC. In it's purest form, at least to what I understand, is that the whole idea of MVC is to have a separation between information handling (controller), information delivery method (model), and the information presentation (View). What [...]]]></description>
			<content:encoded><![CDATA[<p>This is something I started to think about the other day as I have been diving deeper into MVC.  In it's purest form, at least to what I understand, is that the whole idea of MVC is to have a separation between information handling (controller), information delivery method (model), and the information presentation (View).  What this means is that the View itself should only be around to display or return information, but that's it.  Have a form?  Great, here's the information you need to fill out and I'll send it on it's way.  And even with that idea, the View itself doesn't really send anything.  It just passes what it knows off to the model and it's back in happy land.  (The view gets nervous sometimes... performance anxiety)  The whole system works well in actuallity, it does what is expected.  There are no events simulated and possibly tangled.  There's no smoke and mirrors when it comes to the display and what the user is seeing.  I want a grid of users?  Here it is.  I want to edit this user?  Great!  I'll take you to the page that does that.  Life is great and wonderful.</p>
<p>But wait, here comes jQuery, Json, and Asynchronous Calls.  Now I can do crazy things with the view that I could never do before.  Remember that grid of users?  Well you don't really have to go to another page to edit.  Hell, just click this link and a form can appear to take in what you need to change.  Even better, the grid itself will change and allow you to edit any row you want, and when you're done the grid will come back all new an refreshed.  What a crazy party this is now.  Kind of sounds familiar right?  Yeah WebForms.  With these three helpers we've now cut out the middle man in the Model and passed the savings onto you.  Essentially the whole idea has been chucked and jQuery has allowed us to invoke the same event model WebForms was chastised for.  In fact, you could go to the logical end and have one page once again that controls everything.  The View once again has the power much like it did in WebForms (provided you look at the Page and code behind being more like a View than separate entities).  Isn't that the whole thing we were trying to get away from?</p>
<p>I suppose you could make the argument that no one is putting a gun to your head to use jQuery for anything other that simple things like UI manipulation (date pickers, sliding controls, drag drop, ect) but that wouldn't be the situation being argued here, now would it?</p>
<div  class="related_post_title">Related Posts</div><ul class="related_post"><li><a href="http://byatool.com/writing/byatool-com-gets-a-shiny-new-tool/" title="ByATool.com gets a shiny new tool!">ByATool.com gets a shiny new tool!</a></li><li><a href="http://byatool.com/pontification/asp-net-mvc-quick-overview-of-controller-structure/" title="ASP.Net MVC:  Quick Overview of Controller Structure">ASP.Net MVC:  Quick Overview of Controller Structure</a></li><li><a href="http://byatool.com/pontification/aspnet-mvc-is-the-use-of-jquery-asynchronous-calls-a-must/" title="ASP.Net MVC:  Is the Use of jQuery/Asynchronous calls a Must?">ASP.Net MVC:  Is the Use of jQuery/Asynchronous calls a Must?</a></li><li><a href="http://byatool.com/lessons/spark-view-engine-asp-net-mvc-and-you/" title="Spark View Engine, ASP.Net MVC, and You">Spark View Engine, ASP.Net MVC, and You</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://byatool.com/pontification/are-jquery-and-asynchronous-calls-against-mvc/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>ASP.Net MVC, jQuery, JSon, and paging&#8230;  how&#8217;s that for a SOE title?</title>
		<link>http://byatool.com/ui/aspnet-mvc-jquery-json-and-paging-hows-that-for-a-soe-title/</link>
		<comments>http://byatool.com/ui/aspnet-mvc-jquery-json-and-paging-hows-that-for-a-soe-title/#comments</comments>
		<pubDate>Thu, 16 Jul 2009 15:44:11 +0000</pubDate>
		<dc:creator>Sean</dc:creator>
				<category><![CDATA[UI]]></category>
		<category><![CDATA[Dynamic]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[json]]></category>

		<guid isPermaLink="false">http://byatool.com/?p=721</guid>
		<description><![CDATA[One of the things I've come to realize is how easy it easy to do a lot of things with these three buzzwords. In fact, I'm pretty convinced it's so easy that it's actually complex and I am a genius. Not buying it? Neither am I. So for an experiement the other day I decided [...]]]></description>
			<content:encoded><![CDATA[<p>One of the things I've come to realize is how easy it easy to do a lot of things with these three buzzwords. In fact, I'm pretty convinced it's so easy that it's actually complex and I am a genius. Not buying it? Neither am I.</p>
<p>So for an experiement the other day I decided to try my hand at some sort of dynamic grid using jQuery's ajax fun and JSon. Just so happens that this works really well with MVC's REST like makeup. Don't know what REST is? On a very tool level, it's using a url and a command to tell the server what to do. So something like:</p>
<p>www.byatool.com/users/dostuff</p>
<p>Could mean either get all users (if using get) or create a user (If using post). And yes that is probably a ridiculously simplistic view so I'd suggest consulting the <a href="http://en.wikipedia.org/wiki/Representational_State_Transfer">Wikitruth</a>. In an MVC sense this would be:</p>
<p>Controller: Users<br />
Action: dostuff</p>
<p>Now most likely your Get All Users action isn't going to the same as your Add A User action, but it was just a stupid example ok?</p>
<p>However, with jQuery what this means is you have a simple url that it can call and get information from, making it incredibly easy to set up a dynamic grid.</p>
<p>So first off, lets say I have a Forum controller with an action of IndexJquery... yeah I know cheesy name, but it gets the job done. Basically the method IndexJquery would have to take in a page number and optionally (And for this example) how many items to show along with a sort. With that it should return a JSon "object" that will be in this example holds first page, last page, next page, previous page, sortBy, and some kind of list of stuff. (For the two people actually reading this, comment if you want the c# code. It's really just basic MVC stuff.)</p>
<p>The markup for this is pretty simple. I have a div to hold the grid, four directional divs that work as buttons (First, Previous, Next, Last), and two div "butons" for how many items to show.</p>
<pre>    &lt;div&gt;
        &lt;div id="divHolder"&gt;
        &lt;/div&gt;
    &lt;/div&gt;
    &lt;div&gt;
        &lt;div id="divFirstPage" class="divLink floatLeft"&gt;
            &lt;&lt;
        &lt;/div&gt;
        &lt;div id="divPreviousPage" class="divLink floatLeft"&gt;
            &lt;
        &lt;/div&gt;
        &lt;div id="divNextPage" class="divLink floatLeft"&gt;
            &gt;
        &lt;/div&gt;
        &lt;div id="divLastPage" class="divLink floatLeft"&gt;
            &gt;&gt;
        &lt;/div&gt;
    &lt;/div&gt;
    &lt;div class="clear"&gt;&lt;/div&gt;
    &lt;div&gt;
        &lt;div id="divAmountToShowOne" class="divLink floatLeft"&gt;
            1
        &lt;/div&gt;
        &lt;div id="divAmountToShowFive" class="divLink floatLeft"&gt;
            5
        &lt;/div&gt;
    &lt;/div&gt;
    &lt;div class="clear"&gt;&lt;/div&gt;</pre>
<p>As you can see exactly as advertised.</p>
<p>Ready for the call? It's waaaaay hard:</p>
<pre>        <span style="color: #0000ff;">function</span> getGrid(pageNumberIn, amountToShowIn, sortByIn)
        {
            jQuery.getJSON
            (
               <span style="color: #008000;">//This is the url for the information I need
</span>               <span style="color: #800000;">"http://www.someurl.com/Forum/IndexJquery/"</span>,
               <span style="color: #008000;">//this is the construction of the "object" to send... really this just
               //means that I have a method somewhere looking for pageNumber,
               //amountToShow, and sortBy</span>
               {
                   pageNumber: pageNumberIn,
                   amountToShow: amountToShowIn,
                   sortBy: sortByIn
               },
               <span style="color: #008000;">//This is the method to call once this ajax transaction has completed...
</span>               <span style="color: #008000;">//transaction may not be the best word.  Basically it has to be a method
</span>               <span style="color: #008000;">//that takes in the result from the getJSon call
</span>               returned
            );
        }</pre>
<p>Next would be the script to actually create the grid. Looks verbose, but most likely thats because I didn't refactor much.</p>
<pre>    <span style="color: #0000ff;">function</span> returned(jsonObject)
    {
        <span style="color: #008000;">//Have to remove all the previous click event handlers since because
</span>        <span style="color: #008000;">//this is all client side, there's no "refresh" and therefore the object
</span>        <span style="color: #008000;">//is still in memory.  So even though I might call the method to get the
</span>        <span style="color: #008000;">//information, the "objects" are still in memory.</span>
        jQuery(<span style="color: #800000;">"#divFirstPage"</span>).unbind(<span style="color: #800000;">"click"</span>);
        jQuery(<span style="color: #800000;">"#divLastPage"</span>).unbind(<span style="color: #800000;">"click"</span>);
        jQuery(<span style="color: #800000;">"#divNextPage"</span>).unbind(<span style="color: #800000;">"click"</span>);
        jQuery(<span style="color: #800000;">"#divPreviousPage"</span>).unbind(<span style="color: #800000;">"click"</span>);
        jQuery(<span style="color: #800000;">"#divAmountToShowOne"</span>).unbind(<span style="color: #800000;">"click"</span>);
        jQuery(<span style="color: #800000;">"#divAmountToShowFive"</span>).unbind(<span style="color: #800000;">"click"</span>);

        <span style="color: #008000;">//Ok so now that the event is not being listened to, set up the listeners</span>
        <span style="color: #008000;">//The idea is to call that getGrid method and pass in the values straight</span>
        <span style="color: #008000;">//off the previously returned json object.  Using jQuery's easy .click method
</span>        <span style="color: #008000;">//makes this so simple.
</span>        jQuery(<span style="color: #800000;">"#divFirstPage"</span>).click(<span style="color: #0000ff;">function</span>() { getGrid(jsonObject.FirstPage, jsonObject.AmountToShow, jsonObject.SortBy); })
        jQuery(<span style="color: #800000;">"#divPreviousPage"</span>).click(<span style="color: #0000ff;">function</span>() { getGrid(jsonObject.PreviousPage, jsonObject.AmountToShow, jsonObject.SortBy); })
        jQuery(<span style="color: #800000;">"#divNextPage"</span>).click(<span style="color: #0000ff;">function</span>() { getGrid(jsonObject.NextPage, jsonObject.AmountToShow, jsonObject.SortBy); })
        jQuery(<span style="color: #800000;">"#divLastPage"</span>).click(<span style="color: #0000ff;">function</span>() { getGrid(jsonObject.LastPage, jsonObject.AmountToShow, jsonObject.SortBy); })
        jQuery(<span style="color: #800000;">"#divAmountToShowOne"</span>).click(<span style="color: #0000ff;">function</span>() { getGrid(0, 1, jsonObject.SortBy); })
        jQuery(<span style="color: #800000;">"#divAmountToShowFive"</span>).click(<span style="color: #0000ff;">function</span>() { getGrid(0, 5, jsonObject.SortBy); })

        <span style="color: #008000;">//Again since this is client side, the divHolder "object" still is holding
</span>        <span style="color: #008000;">//the previous results.  These have to be cleared.
</span>        jQuery(<span style="color: #800000;">"#divHolder"</span>).children().remove();

        <span style="color: #008000;">//Create the table and loop through the list.
</span>        <span style="color: #0000ff;">var</span> mytable = document.createElement(<span style="color: #800000;">"table"</span>);
        <span style="color: #0000ff;">var</span> mytablebody = document.createElement(<span style="color: #800000;">"tbody"</span>);

        <span style="color: #0000ff;">for</span> (loopCounter = 0; loopCounter &lt; jsonObject.ListForViewing.length; loopCounter++)
        {
           <span style="color: #0000ff;">var</span> currentItem = something.ListForViewing[loopCounter];
           <span style="color: #0000ff;">var</span> mycurrent_row = document.createElement(<span style="color: #800000;">"tr"</span>);

           <span style="color: #0000ff;">var</span> mycurrent_cell = document.createElement(<span style="color: #800000;">"td"</span>);
           <span style="color: #0000ff;">var</span> currentText = document.createTextNode(currentItem.ForumName);
           mycurrent_cell.appendChild(currentText);
           mycurrent_row.appendChild(mycurrent_cell);

           mytablebody.appendChild(mycurrent_row);
        }

        mytable.appendChild(mytablebody);
        <span style="color: #008000;">//Don't forget to add the table to the div!!11
</span>        jQuery(<span style="color: #800000;">"#divHolder"</span>).append(mytable);
        <span style="color: #0000ff;">return</span> <span style="color: #0000ff;">false</span>;
    }</pre>
<p>And boom. So easy even a ca... tool can do it. Now if you want this grid to come preloaded, it's pretty easy:</p>
<pre>
    jQuery(document).ready
    (
        <span style="color: #0000ff;">function</span> setPage()
        {
            getGrid(0, 10, null);
        }
    )</pre>
<div  class="related_post_title">Related Posts</div><ul class="related_post"><li><a href="http://byatool.com/ui/jquery-slide-menu-another-cause-i-can-experiment/" title="jQuery Slide Menu&#8230;  Another Cause I Can Experiment">jQuery Slide Menu&#8230;  Another Cause I Can Experiment</a></li><li><a href="http://byatool.com/ui/jquery-slide-and-pairing-a-divs-hover-with-a-divs-slide/" title="jQuery Slide and Pairing a Div&#8217;s Hover With a Div&#8217;s Slide">jQuery Slide and Pairing a Div&#8217;s Hover With a Div&#8217;s Slide</a></li><li><a href="http://byatool.com/ui/556/" title="jQuery: Add a Pop Up Div to a Link Dynamically">jQuery: Add a Pop Up Div to a Link Dynamically</a></li><li><a href="http://byatool.com/ui/jquery-position-absolute-and-how-to-make-it-all-work/" title="JQuery, Position : Absolute, and How to Make It All Work">JQuery, Position : Absolute, and How to Make It All Work</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://byatool.com/ui/aspnet-mvc-jquery-json-and-paging-hows-that-for-a-soe-title/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>jQuery: Add a Pop Up Div to a Link Dynamically</title>
		<link>http://byatool.com/ui/556/</link>
		<comments>http://byatool.com/ui/556/#comments</comments>
		<pubDate>Mon, 16 Mar 2009 14:50:31 +0000</pubDate>
		<dc:creator>Sean</dc:creator>
				<category><![CDATA[UI]]></category>
		<category><![CDATA[Dynamic]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://byatool.com/?p=556</guid>
		<description><![CDATA[So as an exercise to learn more about jQuery, I decided to redo this little gem using jQuery. Have to say though only technically XHTML compliant, it worked out much better and with less code. So the idea is to have something really easy for non programmers (You know, lesser people) to be able to [...]]]></description>
			<content:encoded><![CDATA[<p>So as an exercise to learn more about jQuery, I decided to redo this <a href="http://byatool.com/index.php/ui/add-a-pop-up-div-to-a-link-dynamically">little gem</a> using jQuery. Have to say though only technically XHTML compliant, it worked out much better and with less code. So the idea is to have something really easy for non programmers (You know, lesser people) to be able to have a pop up comment added to some chunk of text on a web site. What I came up with before was ok but kind of annoying since it looked like this:</p>
<pre>&lt;<span style="color: #800000;">a</span> <span style="color: #ff0000;">onclick</span><span style="color: #0000ff;">="return ShowCommentForPost('1', this, 'THIS IS SO STUPID!');"</span> <span style="color: #ff0000;">href</span><span style="color: #0000ff;">="www.byatool.com"</span>&gt;word.&lt;<span style="color: #800000;">/a</span>&gt;</pre>
<p>Kind of annoying since I would have to explain that '1' is the name and it has to be unique for every one of <a class="showItLink" href="http://www.byatool.com" xmlns:comment="Hahaha... yeah they'll make them unique.  Really.  People aren't lazy.">these</a>, this isn't really understood by those people, and well it just seems more complicated then it needs to be. So what if I told you it could look like this?</p>
<pre>&lt;<span style="color: #800000;">a</span> <span style="color: #ff0000;">href</span><span style="color: #0000ff;">="http://www.byatool.com"</span> <span style="color: #ff0000;">class</span><span style="color: #0000ff;">="showItLink"</span> <span style="color: #ff0000;">xmlns:comment</span><span style="color: #0000ff;">="hihihi"</span>&gt;HI&lt;<span style="color: #800000;">/a</span>&gt;</pre>
<p>Gorsh, that seems even better and it works in both IE and Firefox... which might be a first for this site and anything javascript. First let's get the css out of the way, shall we?</p>
<pre>    .<span style="color: #800000;">showItLink</span>
    {
    }

    .<span style="color: #800000;">postComment</span>
    {
        <span style="color: #ff0000;">background-color</span>:<span style="color: #0000ff;">Gray</span>;
        <span style="color: #ff0000;">border-color</span>:<span style="color: #0000ff;">Black</span>;
        <span style="color: #ff0000;">border-style</span>:<span style="color: #0000ff;">dotted</span>;
        <span style="color: #ff0000;">border-width</span>:<span style="color: #0000ff;">thin</span>;
        <span style="color: #ff0000;">color</span>:<span style="color: #0000ff;">White</span>;
        <span style="color: #ff0000;">margin-right</span>:<span style="color: #0000ff;">3px</span>;
        <span style="color: #ff0000;">padding</span>:<span style="color: #0000ff;">3px</span>;
        <span style="color: #ff0000;">position</span>:<span style="color: #0000ff;">absolute</span>;
        <span style="color: #ff0000;">text-decoration</span>:<span style="color: #0000ff;">none</span>;
        <span style="color: #ff0000;">z-index</span>:<span style="color: #0000ff;">50</span>;
    }</pre>
<p>Most of the is just for looks, but like the older example I've called upon the power of <a href="http://byatool.com/index.php/ui/jquery-position-absolute-and-how-to-make-it-all-work">position:absolute</a> and z-index well that's just pulling it in front of everything else.</p>
<p>Next part will be the actual code, and if you take the method <a class="showItLink" href="http://www.byatool.com" xmlns:comment="ANOTHER PLUG AHHHHH!!!11">from</a> <a href="http://byatool.com/index.php/ui/jquery-position-absolute-and-how-to-make-it-all-work">THE POSITION ABSOLUTE POST</a></p>
<pre>    <span style="color: #0000ff;">function</span> SetTopAndLeft(parentContainer, elementToSet)
    {
        <span style="color: #0000ff;">var</span> containerPosition;

        containerPosition = $(parentContainer).position();
        $(elementToSet).css({ top: containerPosition.top + 10, left: containerPosition.left + 10 });
    }</pre>
<p>and add in a simple span creation method:</p>
<pre>    <span style="color: #0000ff;">function</span> CreateDiv(innerText, cssClass)
    {
        <span style="color: #0000ff;">var</span> spanToAdd;

        spanToAdd = document.createElement(<span style="color: #ff0000;">'span'</span>);
        spanToAdd.className = cssClass;
        spanToAdd.innerHTML = innerText;

        <span style="color: #0000ff;">return</span> spanToAdd;
    }</pre>
<p>you're ready for the actual fun part... making sure something pops up when the link is clicked.</p>
<pre>jQuery(document).ready  <span style="color: #008000;">//Everything inside this will load as soon as the DOM is loaded and before the page contents are loaded.</span><a href="http://www.learningjquery.com/2006/09/introducing-document-ready"><span style="color: #008000;">*</span></a>
(
    <span style="color: #0000ff;">function</span>()  //this is the start of an anonymous method
    {
        jQuery(<span style="color: #800000;">".showItLink"</span>).click <span style="color: #008000;">//find all things with the .showItLink class and assign the click event to the next anonymous method
        </span>(
            <span style="color: #0000ff;">function</span>(event) <span style="color: #008000;">//this is the start of an anonymous method for the click event</span>
            {
                <span style="color: #0000ff;">var</span> containerPosition;
                <span style="color: #0000ff;">var</span> createdSpan;
                <span style="color: #0000ff;">var</span> comment;

                comment = jQuery(this).attr(<span style="color: #800000;">"xmlns:comment"</span>);  <span style="color: #008000;">//Get the value from the comment attribute on the link.</span>
                createdSpan = jQuery(this).children(<span style="color: #800000;">".postComment"</span>); <span style="color: #008000;">//Find a possible span already attached to the link if it exists.  The span is of class 'postComment'</span>

                <span style="color: #0000ff;">if</span> (createdSpan.length == 0)  <span style="color: #008000;">//span doesn't exist</span>
                {
                    createdSpan= CreateDiv(comment, <span style="color: #800000;">"postComment"</span>);  <span style="color: #008000;">//create the span</span>
                    jQuery(this).append(createdSpan);  <span style="color: #008000;">//Add the span to the link</span>
                    jQuery(this).children(<span style="color: #800000;">".postComment"</span>).hide();  <span style="color: #008000;">//Make sure the new span is hidden
</span>                }
                SetTopAndLeft(this, createdSpan);  <span style="color: #008000;">//Set the position of the span</span>
                jQuery(createdDiv).toggle();  <span style="color: #008000;">//This will hide if it's showing, show if it's hidden... kind of nice huh?</span>

                event.preventDefault();  <span style="color: #008000;">//Equivalent to false.  Need this for Firefox.</span>
            }
        );
    }
);</pre>
<p>And boom you have something that works. Hooray.</p>
<p>Couple things of note:</p>
<p>.Hide - At first I though this would screw up my class for the span by removing the current class and adding display:none. Turns out it doesn't harm the original class. Kind of nice.</p>
<p>.Toggle() - This is really nice. It will hide if it is showing and show if hidden. Stupid easy to use and is pretty effective. Just like .Hide, the class of the element is not harmed.</p>
<p>$ versus jQuery - Some people might notice that I am not using the short hand $ for my jQuery calls. Turns out that it might be safer this way. There are other javascript libraries that use the $ short hand like prototype. I ran into this with <a class="showItLink" href="http://byatool.com" xmlns:comment="Go figure...">WordPress </a>since it uses both jQuery and Prototype and blocks jQuery from using $ since it could conflict with other libraries. Weeeee!</p>
<div  class="related_post_title">Related Posts</div><ul class="related_post"><li><a href="http://byatool.com/ui/jquery-position-absolute-and-how-to-make-it-all-work/" title="JQuery, Position : Absolute, and How to Make It All Work">JQuery, Position : Absolute, and How to Make It All Work</a></li><li><a href="http://byatool.com/lessons/child-iframe-page-interacting-with-parent-page-yeah-i-went-there/" title="Child IFrame Page Interacting with Parent Page&#8230; Yeah I went there.">Child IFrame Page Interacting with Parent Page&#8230; Yeah I went there.</a></li><li><a href="http://byatool.com/lessons/jquery-validation-how-to-use-to-get-rid-of-even-the-toughest-stains/" title="jQuery Validation &#8211; How to Use to Get Rid Of Even The Toughest Stains">jQuery Validation &#8211; How to Use to Get Rid Of Even The Toughest Stains</a></li><li><a href="http://byatool.com/ui/jquery-slide-menu-another-cause-i-can-experiment/" title="jQuery Slide Menu&#8230;  Another Cause I Can Experiment">jQuery Slide Menu&#8230;  Another Cause I Can Experiment</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://byatool.com/ui/556/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JQuery, Position : Absolute, and How to Make It All Work</title>
		<link>http://byatool.com/ui/jquery-position-absolute-and-how-to-make-it-all-work/</link>
		<comments>http://byatool.com/ui/jquery-position-absolute-and-how-to-make-it-all-work/#comments</comments>
		<pubDate>Fri, 13 Mar 2009 20:39:59 +0000</pubDate>
		<dc:creator>Sean</dc:creator>
				<category><![CDATA[UI]]></category>
		<category><![CDATA[Dynamic]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://byatool.com/?p=549</guid>
		<description><![CDATA[This is a really quick one but when I was taking my cheesy pop up and reworking it using JQuery (After Andre the Annoying wouldn't shut up about it), I ran into a fun problem: position:absolute wasn't working like it should. You know "absolute is positioned at the specified coordinates relative to its containing block.". [...]]]></description>
			<content:encoded><![CDATA[<p>This is a really quick one but when I was taking <a href="http://byatool.com/index.php/ui/add-a-pop-up-div-to-a-link-dynamically">my cheesy pop up</a> and reworking it using <a href="http://docs.jquery.com/Main_Page">JQuery</a> (After Andre the Annoying wouldn't shut up about it), I ran into a fun problem: position:absolute wasn't working like it should. You know "absolute is positioned at the specified coordinates relative to its containing block.". Meaning it should at worst show up within it's container, where ever that is. Now IE is fine with that and the thing was showing up well:</p>
<pre><img title="absolutepositionie" src="http://byatool.com/wp-content/uploads/2009/03/absolutepositionie.png" alt="absolutepositionie" width="247" height="49" /></pre>
<p>Firefox? Not so much:</p>
<pre><img title="absolutepositionfirefox" src="http://byatool.com/wp-content/uploads/2009/03/absolutepositionfirefox.png" alt="absolutepositionfirefox" width="280" height="70" /></pre>
<p>Well... turns out JQuery pretty much does it for me. With a simple method, you can set one element's position relative to a parent's position:</p>
<pre>    <span style="color: #0000ff;">function</span> SetTopAndLeft(parentContainer, elementToSet)
    {
        <span style="color: #0000ff;">var</span> containerPosition;

        containerPosition = $(parentContainer).position();
        $(elementToSet).css({ top: containerPosition.top + 10, left: containerPosition.left + 10 });
    }</pre>
<p>Really simple, you get the position of the parent container and you set the child element's top and left to it. Or in this case, I have it just off since hiding the parent container could be problematic. (Say if the parent container is a link AND NOW YOU CAN'T FIND IT TO CLICK ON IT AND THINGS HAPPEN BAD THINGS AND THE WORLD EXPLODES BECAUSE OF YOU!)</p>
<p>And boom, you can for once be a winner just like me.</p>
<div  class="related_post_title">Related Posts</div><ul class="related_post"><li><a href="http://byatool.com/ui/556/" title="jQuery: Add a Pop Up Div to a Link Dynamically">jQuery: Add a Pop Up Div to a Link Dynamically</a></li><li><a href="http://byatool.com/lessons/child-iframe-page-interacting-with-parent-page-yeah-i-went-there/" title="Child IFrame Page Interacting with Parent Page&#8230; Yeah I went there.">Child IFrame Page Interacting with Parent Page&#8230; Yeah I went there.</a></li><li><a href="http://byatool.com/lessons/jquery-validation-how-to-use-to-get-rid-of-even-the-toughest-stains/" title="jQuery Validation &#8211; How to Use to Get Rid Of Even The Toughest Stains">jQuery Validation &#8211; How to Use to Get Rid Of Even The Toughest Stains</a></li><li><a href="http://byatool.com/ui/jquery-slide-menu-another-cause-i-can-experiment/" title="jQuery Slide Menu&#8230;  Another Cause I Can Experiment">jQuery Slide Menu&#8230;  Another Cause I Can Experiment</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://byatool.com/ui/jquery-position-absolute-and-how-to-make-it-all-work/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>My jQuery Primer</title>
		<link>http://byatool.com/ui/my-jquery-primer/</link>
		<comments>http://byatool.com/ui/my-jquery-primer/#comments</comments>
		<pubDate>Wed, 04 Feb 2009 21:45:15 +0000</pubDate>
		<dc:creator>Andre</dc:creator>
				<category><![CDATA[.Net Issues]]></category>
		<category><![CDATA[Plain Text]]></category>
		<category><![CDATA[UI]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://byatool.com/?p=372</guid>
		<description><![CDATA[So you have been reading about jQuery and want to dive in and try some? I recently attended the MSDN Dev Conference in Detroit where jQuery integration and client-side programming were very hot topics. With Microsoft's acceptance of the open source library, I figured I would give it a try. This is what I have [...]]]></description>
			<content:encoded><![CDATA[<p>So you have been reading about jQuery and want to dive in and try some?  I recently attended the MSDN Dev Conference in Detroit where jQuery integration and client-side programming were very hot topics.  With Microsoft's acceptance of the open source library, I figured I would give it a try.  This is what I have learned so far.</p>
<p>Before I can show you what you can do with jQuery, I think I should probably show you how to get a reference to jQuery into your code.</p>
<p>In ASP.NET you can add your reference directly to your Script Manager</p>

<div class="wp_syntax"><div class="code"><pre class="asp" style="font-family:monospace;"><span style="color: #006600; font-weight: bold;">&lt;</span>asp<span style="color: #006600; font-weight: bold;">:</span>scriptmanager id<span style="color: #006600; font-weight: bold;">=</span><span style="color: #cc0000;">&quot;pageScriptManager&quot;</span> runat<span style="color: #006600; font-weight: bold;">=</span><span style="color: #cc0000;">&quot;server&quot;</span><span style="color: #006600; font-weight: bold;">&gt;</span>
	<span style="color: #006600; font-weight: bold;">&lt;</span>scripts<span style="color: #006600; font-weight: bold;">&gt;</span>
		<span style="color: #006600; font-weight: bold;">&lt;</span>asp<span style="color: #006600; font-weight: bold;">:</span>scriptreference path<span style="color: #006600; font-weight: bold;">=</span><span style="color: #cc0000;">&quot;/client/jquery-1.3.1.min.js&quot;</span> <span style="color: #006600; font-weight: bold;">/&gt;</span>
	<span style="color: #006600; font-weight: bold;">&lt;/</span>scripts<span style="color: #006600; font-weight: bold;">&gt;</span>
<span style="color: #006600; font-weight: bold;">&lt;/</span>asp<span style="color: #006600; font-weight: bold;">:</span>scriptmanager<span style="color: #006600; font-weight: bold;">&gt;</span></pre></div></div>

<p>What does jQuery have to offer?  First and foremost, jQuery has given me power over the Document Object Model (DOM)!  jQuery Selectors are the greatest thing since sliced bread, no lie.  Being able to EASILY find an object or group of objects in the DOM by ID, CSS Class, or by HTML Tag is something web developers have long needed.</p>
<p>To select an object from the DOM by ID would look like this:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#ID_Goes_Here'</span><span style="color: #009900;">&#41;</span></pre></div></div>

<p>To select an object from the DOM by CSS Class would look like this:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'.CSS_Class_Name_Goes_Here'</span><span style="color: #009900;">&#41;</span></pre></div></div>

<p>To select an object from the DOM by HTML Tag would look like this:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'&lt;Tag_Goes_Here&gt;'</span><span style="color: #009900;">&#41;</span></pre></div></div>

<p>With jQuery Selectors being so simple, it allows the developer to easily select an object or a group of objects.  Now that we can select objects, what can we do with them?  This is where the power of Selectors really builds into what else you can do.  In a web application, round trips to the server to manage UI is wasteful.  I avoid JavaScript like the plague because it's a pain in the ass.  jQuery makes client-side UI management feel like climbing the rope in gym class.</p>
<p>For example, if I have a label that I want to be rendered but not visible I could create the label.</p>

<div class="wp_syntax"><div class="code"><pre class="asp" style="font-family:monospace;"><span style="color: #006600; font-weight: bold;">&lt;</span>asp<span style="color: #006600; font-weight: bold;">:</span>label id<span style="color: #006600; font-weight: bold;">=</span><span style="color: #cc0000;">&quot;Label4&quot;</span> runat<span style="color: #006600; font-weight: bold;">=</span><span style="color: #cc0000;">&quot;server&quot;</span> cssclass<span style="color: #006600; font-weight: bold;">=</span><span style="color: #cc0000;">&quot;myLabel&quot;</span> text<span style="color: #006600; font-weight: bold;">=</span><span style="color: #cc0000;">&quot;This is &quot;</span> <span style="color: #006600; font-weight: bold;">/&gt;</span></pre></div></div>

<p>And later on in jQuery I can hide it like this.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#Label4'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">css</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'display'</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'none'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>It's nice to be able to easily select an object and modify it, but what if you have a whole group of items you want to modify?  With jQuery, you can EASILY loop through a collection of objects.<br />
In this example I have a group of labels.</p>

<div class="wp_syntax"><div class="code"><pre class="asp" style="font-family:monospace;"><span style="color: #006600; font-weight: bold;">&lt;</span>asp<span style="color: #006600; font-weight: bold;">:</span>label id<span style="color: #006600; font-weight: bold;">=</span><span style="color: #cc0000;">&quot;Label1&quot;</span> runat<span style="color: #006600; font-weight: bold;">=</span><span style="color: #cc0000;">&quot;server&quot;</span> cssclass<span style="color: #006600; font-weight: bold;">=</span><span style="color: #cc0000;">&quot;myLabel&quot;</span> text<span style="color: #006600; font-weight: bold;">=</span><span style="color: #cc0000;">&quot;This is &quot;</span>  <span style="color: #006600; font-weight: bold;">/&gt;</span>
<span style="color: #006600; font-weight: bold;">&lt;</span>asp<span style="color: #006600; font-weight: bold;">:</span>label id<span style="color: #006600; font-weight: bold;">=</span><span style="color: #cc0000;">&quot;Label2&quot;</span> runat<span style="color: #006600; font-weight: bold;">=</span><span style="color: #cc0000;">&quot;server&quot;</span> cssclass<span style="color: #006600; font-weight: bold;">=</span><span style="color: #cc0000;">&quot;myLabel&quot;</span> text<span style="color: #006600; font-weight: bold;">=</span><span style="color: #cc0000;">&quot;This is &quot;</span> <span style="color: #006600; font-weight: bold;">/&gt;</span>
<span style="color: #006600; font-weight: bold;">&lt;</span>asp<span style="color: #006600; font-weight: bold;">:</span>label id<span style="color: #006600; font-weight: bold;">=</span><span style="color: #cc0000;">&quot;Label3&quot;</span> runat<span style="color: #006600; font-weight: bold;">=</span><span style="color: #cc0000;">&quot;server&quot;</span> cssclass<span style="color: #006600; font-weight: bold;">=</span><span style="color: #cc0000;">&quot;myLabel&quot;</span> text<span style="color: #006600; font-weight: bold;">=</span><span style="color: #cc0000;">&quot;This is &quot;</span> <span style="color: #006600; font-weight: bold;">/&gt;</span>
<span style="color: #006600; font-weight: bold;">&lt;</span>asp<span style="color: #006600; font-weight: bold;">:</span>label id<span style="color: #006600; font-weight: bold;">=</span><span style="color: #cc0000;">&quot;Label4&quot;</span> runat<span style="color: #006600; font-weight: bold;">=</span><span style="color: #cc0000;">&quot;server&quot;</span> cssclass<span style="color: #006600; font-weight: bold;">=</span><span style="color: #cc0000;">&quot;myLabel&quot;</span> text<span style="color: #006600; font-weight: bold;">=</span><span style="color: #cc0000;">&quot;This is &quot;</span> <span style="color: #006600; font-weight: bold;">/&gt;</span></pre></div></div>

<p>Now I want to update the text of each label to include its ID.  I am going to loop through each object in the DOM with a CSS Class of .myLabel.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'.myLabel'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">each</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">append</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">id</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>What the jQuery code above does is execute a function that will append the object's ID to its text value.  Notice the Selector inside the function $(this).  The syntax is used to find the loop's current object in the DOM.</p>
<p>I do a lot of web work where I create controls on the fly.  For my last example, I just wanted to show a way to quickly insert some HTML into a container object.</p>
<p>I will start with a Panel AKA a DIV.</p>

<div class="wp_syntax"><div class="code"><pre class="asp" style="font-family:monospace;"><span style="color: #006600; font-weight: bold;">&lt;</span>asp<span style="color: #006600; font-weight: bold;">:</span>panel id<span style="color: #006600; font-weight: bold;">=</span><span style="color: #cc0000;">&quot;Panel1&quot;</span> runat<span style="color: #006600; font-weight: bold;">=</span><span style="color: #cc0000;">&quot;server&quot;</span> <span style="color: #006600; font-weight: bold;">/&gt;</span></pre></div></div>

<p>Now I am going to use jQuery to select my DIV and add some HTML to it.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#Panel1&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">html</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;&lt;ul&gt;&lt;li&gt;Item One&lt;/li&gt;&lt;li&gt;Item 2&lt;/li&gt;&lt;/ul&gt;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Now I have shown you some snippets here and there, let me show you what my page actually looks like.</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #00bbdd;">&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">html</span> xmlns<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://www.w3.org/1999/xhtml&quot;</span> &gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">head</span> runat<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;server&quot;</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">title</span>&gt;</span>jQuery Examples<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">title</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">link</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;/style/jQuery.css&quot;</span> <span style="color: #000066;">rel</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;Stylesheet&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/css&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span>&gt;</span>
			function pageLoad() {
				$('.myLabel').each(function() { $(this).append(this.id); });
				$('.myLabel').css('color', '#FFFFFF').css('font-size', '30px');
				$('#Label4').css('display', 'none');
				$(&quot;#Panel1&quot;).html(&quot;<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">ul</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;</span>Item One<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;</span>Item 2<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">ul</span>&gt;</span>&quot;);
			}
		<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">head</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">body</span>&gt;</span>
	    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">form</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;pageForm&quot;</span> runat<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;server&quot;</span>&gt;</span>
			<span style="color: #009900;">&lt;asp:scriptmanager <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;pageScriptManager&quot;</span> runat<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;server&quot;</span>&gt;</span>
				<span style="color: #009900;">&lt;scripts&gt;</span>
					<span style="color: #009900;">&lt;asp:scriptreference path<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;/client/jquery-1.3.1.min.js&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
				<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span>scripts&gt;</span>
			<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span>asp:scriptmanager&gt;</span>
&nbsp;
			<span style="color: #009900;">&lt;asp:<span style="color: #000066;">label</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;Label1&quot;</span> runat<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;server&quot;</span> cssclass<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;myLabel&quot;</span> <span style="color: #000066;">text</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;This is &quot;</span>  <span style="color: #66cc66;">/</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">br</span> <span style="color: #66cc66;">/</span>&gt;</span>
			<span style="color: #009900;">&lt;asp:<span style="color: #000066;">label</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;Label2&quot;</span> runat<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;server&quot;</span> cssclass<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;myLabel&quot;</span> <span style="color: #000066;">text</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;This is &quot;</span> <span style="color: #66cc66;">/</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">br</span> <span style="color: #66cc66;">/</span>&gt;</span>
			<span style="color: #009900;">&lt;asp:<span style="color: #000066;">label</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;Label3&quot;</span> runat<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;server&quot;</span> cssclass<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;myLabel&quot;</span> <span style="color: #000066;">text</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;This is &quot;</span> <span style="color: #66cc66;">/</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">br</span> <span style="color: #66cc66;">/</span>&gt;</span>
			<span style="color: #009900;">&lt;asp:<span style="color: #000066;">label</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;Label4&quot;</span> runat<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;server&quot;</span> cssclass<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;myLabel&quot;</span> <span style="color: #000066;">text</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;This is &quot;</span> <span style="color: #66cc66;">/</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">br</span> <span style="color: #66cc66;">/</span>&gt;</span>
&nbsp;
			<span style="color: #009900;">&lt;asp:panel <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;Panel1&quot;</span> runat<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;server&quot;</span> <span style="color: #66cc66;">/</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">br</span> <span style="color: #66cc66;">/</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">form</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">body</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">html</span>&gt;</span></pre></div></div>

<p><strong>Links</strong><br />
jQuery: <a href="http://www.jQuery.com/" target="_blank">http://www.jQuery.com/</a><br />
Document Object Model: <a href="http://en.wikipedia.org/wiki/Document_Object_Model" target="_blank">http://en.wikipedia.org/wiki/Document_Object_Model</a></p>
<p>Twitter: http://www.twitter.com/RockCityGhost</p>
<div  class="related_post_title">Related Posts</div><ul class="related_post"><li><a href="http://byatool.com/writing/byatool-com-gets-a-shiny-new-tool/" title="ByATool.com gets a shiny new tool!">ByATool.com gets a shiny new tool!</a></li><li><a href="http://byatool.com/lessons/child-iframe-page-interacting-with-parent-page-yeah-i-went-there/" title="Child IFrame Page Interacting with Parent Page&#8230; Yeah I went there.">Child IFrame Page Interacting with Parent Page&#8230; Yeah I went there.</a></li><li><a href="http://byatool.com/lessons/get-the-jquery-datepicker-to-work-with-jquery-modal-dialog/" title="Get the jQuery DatePicker to Work With jQuery Modal Dialog">Get the jQuery DatePicker to Work With jQuery Modal Dialog</a></li><li><a href="http://byatool.com/ui/jquery-modal-dialog-hide-that-stupid-x-button-windows-close-button/" title="jQuery Modal Dialog : Hide That Stupid X Button / Windows Close Button">jQuery Modal Dialog : Hide That Stupid X Button / Windows Close Button</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://byatool.com/ui/my-jquery-primer/feed/</wfw:commentRss>
		<slash:comments>21</slash:comments>
		</item>
	</channel>
</rss>
