<?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>Bloggerrific &#187; jquery</title>
	<atom:link href="http://www.davidjrush.com/blog/tag/jquery/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.davidjrush.com</link>
	<description>David J. Rush is a web designer and usability consultant in Pittsburgh who freelances and blogs about anything web related.</description>
	<lastBuildDate>Thu, 05 Jan 2012 02:50:29 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>JQuery: Creating a Text Watermark</title>
		<link>http://www.davidjrush.com/blog/2011/10/jquery-creating-a-textbox-text-watermark/</link>
		<comments>http://www.davidjrush.com/blog/2011/10/jquery-creating-a-textbox-text-watermark/#comments</comments>
		<pubDate>Wed, 05 Oct 2011 12:00:35 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[JQuery Tutorials]]></category>
		<category><![CDATA[javascript basics]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[watermarks]]></category>

		<guid isPermaLink="false">http://www.davidjrush.com/?p=988</guid>
		<description><![CDATA[My post on creating a text watermark with javascript has been pretty popular. One comment had to do with being able to implement that watermark without being able to edit the HTML (only having access to CSS and Javascript). The easy solution to that is using JQuery. So as a follow up to that post, [...]]]></description>
			<content:encoded><![CDATA[<p>My post on creating a <a href="http://www.davidjrush.com/blog/2011/01/javascript-creating-a-simple-textbox-watermark-with-text/">text watermark with javascript</a> has been pretty popular. One comment had to do with being able to implement that watermark without being able to edit the HTML (only having access to CSS and Javascript). The easy solution to that is using JQuery. So as a follow up to that post, I wrote a quick tutorial on a text watermark using JQuery instead of plain old Javascript. Here is an example in action:</p>
<input id="inputTextboxId" type="text" />
<script type="text/javascript">
$(document).ready(function() {
   var watermark = 'textbox watermark text';
   $('#inputTextboxId').blur(function(){
      if ($(this).val().length == 0)
         $(this).val(watermark).addClass('watermark');
   }).focus(function(){
      if ($(this).val() == watermark)
         $(this).val('').removeClass('watermark');
   }).val(watermark).addClass('watermark');;
});
</script></p>
<style type="text/css">
   input#inputTextboxId { width: 200px; margin: 10px 0px 10px 200px; }
   input#inputTextboxId.watermark { color: #999; }
</style>
<p>To do this, you&#8217;ll need the following code:</p>
<p><strong>The HTML:</strong></p>
<pre class="brush: xml; title: ; notranslate">&lt;input id=&quot;inputTextboxId&quot; type=&quot;text&quot; /&gt;</pre>
<p><strong>The Javascript:</strong></p>
<pre class="brush: jscript; title: ; notranslate">
$(document).ready(function() {
  var watermark = '&lt;span&gt;textbox watermark text&lt;/span&gt;';
  $('#inputTextboxId').blur(function(){
    if ($(this).val().length == 0)
      $(this).val(watermark).addClass('watermark');
  }).focus(function(){
    if ($(this).val() == watermark)
      $(this).val('').removeClass('watermark');
  }).val(watermark).addClass('watermark');
});</pre>
<p>This javascript binds an event to both the blur and focus events of the input field. When the field gains focus (someone clicks in), the JS checks to see if the value of the input field is equivalent to the watermark, in which case it will clear it. When the field loses focus (someone clicks out), the JS checks to see if the field is empty, and if it is, places the watermark back in. The javascript also sets the default value of the textbox to the watermark so that you don&#8217;t have to edit the HTML at all.</p>
<p><strong>Lastly, the CSS if you are feeling fancy:</strong></p>
<pre class="brush: css; title: ; notranslate">input.watermark { color: #999; }</pre>
<p>That&#8217;s it! A simple text watermark using JQuery that doesn&#8217;t require touching HTML at all.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.davidjrush.com/blog/2011/10/jquery-creating-a-textbox-text-watermark/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>AJAX: Loading External Content</title>
		<link>http://www.davidjrush.com/blog/2010/09/ajax-loading-external-content/</link>
		<comments>http://www.davidjrush.com/blog/2010/09/ajax-loading-external-content/#comments</comments>
		<pubDate>Wed, 29 Sep 2010 14:00:54 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[AJAX Tutorials]]></category>
		<category><![CDATA[AJAX]]></category>
		<category><![CDATA[javascript basics]]></category>
		<category><![CDATA[jquery]]></category>

		<guid isPermaLink="false">http://www.davidjrush.com/blog/?p=352</guid>
		<description><![CDATA[Asynchronous Javascript and XML, is a method used to communicate with the server and load new content in a website without having to reload the page. You’ve probably seen it all over the web, and now you are going to learn how to implement it yourself! Step 1: Install JQuery: Not sure what jquery is? [...]]]></description>
			<content:encoded><![CDATA[<p>Asynchronous Javascript and XML, is a method used to communicate with  the server and load new content in a website without having to reload  the page. You’ve probably seen it all over the web, and now you are going to learn how to implement it yourself!</p>
<p><strong>Step 1: Install JQuery:</strong> Not sure what jquery is? It is basically a bunch a prebuilt javascript to make your life a whole lot easier. Go to <a href="http://code.google.com/p/jqueryjs/downloads/detail?name=jquery-1.3.2.min.js" target="_blank">http://code.google.com/p/jqueryjs/downloads/detail?name=jquery-1.3.2.min.js</a> to download the most stable version of JQuery as of this post publishing date (1.3.2) or <a href="http://jquery.com/" target="_blank">http://jquery.com/</a> for the most recent version (1.4.2).</p>
<p><strong>Step 2: Install JQuery UI For Better Animations (optional):</strong> I highly advise using some animations to spice up the interaction of your AJAX. When a user clicks something that fires your AJAX, they want to know something is happening. If it happens too quickly, they won&#8217;t know, so we&#8217;ll actually have to slow it down a bit for them. Visit <a href="http://jqueryui.com/download" target="_blank">http://jqueryui.com/download</a> to download the UI components if you&#8217;d like these better animations. I advise the &#8220;core&#8221;, the &#8220;effects core&#8221;, and the &#8220;effects blind&#8221;. You can try other effects as well such as &#8220;fold&#8221; if you want a different visual.</p>
<p><strong>Step 3: Make Two Different Pages:</strong> The concept of AJAX relies on the existence of two files. The first file is a normal webpage that will contain whatever you want to reload. The second file should use HTML, but not be contained within any html or body tags. The reason for this is your the javascript you are about to create will be loading the entire second document <em>literally within</em> the first document. You can&#8217;t have two html or body tags, so don&#8217;t use them! Having trouble understanding, well how about an example.  Say you are creating a search feature on your site. The first document is the actual search page that contains the search bar and submit button (say http://samplesite.com/search.html). The second document will hold the results of the search that was submitted on the first page and usually takes some sort of arguments, variables, query strings, or whatever else you&#8217;d like to call them (in the case of this example, probably the search terms entered in the search bar).</p>
<p><strong>The HTML for the first document (front-facing):</strong></p>
<pre class="brush: xml; title: ; notranslate">
&lt;img id=&quot;loadImg&quot; src=&quot;animatedGifLocation&quot; alt=&quot;Loading...&quot; /&gt;
&lt;div id=&quot;opacityWrap&quot;&gt;&lt;div id=&quot;fillBox&quot;&gt;&lt;/div&gt;&lt;/div&gt;
&lt;input id=&quot;queryField&quot; type=&quot;text&quot; value=&quot;&quot; /&gt;
&lt;input id=&quot;submitQueryButton&quot; type=&quot;button&quot; value=&quot;Submit Query&quot; /&gt;
</pre>
<p><strong>The PHP for the second document (hidden from users):</strong></p>
<pre class="brush: php; title: ; notranslate">&lt;?php
  $textBoxContent = $_GET['data'];
  echo (&quot;&lt;p&gt;&quot;.$textBoxContent.&quot;&lt;/p&gt;&quot;);
?&gt;</pre>
<p><strong>Step 4: Write Some Javascript:</strong> Using some preexisting jquery functions, all we have to do is throw together a simple function that is called on the button click (or whatever else works for your particular situation). This particular javascript below uses an animated gif to indicate loading and a div two grey out the loading content box.</p>
<pre class="brush: jscript; title: ; notranslate">
$(&quot;#submitQueryButton&quot;).click(function() {
  $(&quot;#opacityWrap&quot;).animate({ opacity: .15 }, 100);
  $(&quot;#loadImg&quot;).show();
  $(&quot;#fillBox&quot;).load(&quot;secondPageURLhere?query=&quot; + $(&quot;#queryField&quot;).val(),function() {
    $(&quot;#loadImg&quot;).hide();
    $(&quot;#opacityWrap&quot;).animate({ opacity: 1.0 }, 100);
  });
});
</pre>
<p><strong>Step 5: See It In Action:</strong></p>
<div class="example" style="position: relative;">
<input id="entryField" type="text" value="" />
<input id="theButton" type="button" value="Submit Content" />
<div class="clear"></div>
<div class="ajaxWrapper">
<img id="loadImg" src="http://www.davidjrush.com/images/tutorials/expandCircle.gif" alt="Loading..." /></p>
<div id="opacityWrap">
<p id="fillBox">Dependent on whether you enter a number or a word into the text box, different content will load here. The button calls an AJAX function that loads another page. This page, dependent on the request sent by the AJAX, outputs the page&#8217;s determination of what you entered.</p>
</div>
</div>
<p><script type="text/javascript">
$("#theButton").click(function() {
  var content = $("#entryField").val();
  $("#opacityWrap").animate({opacity:0.15},100);
  $("#loadImg").show();
  $("#fillBox").load("http://www.davidjrush.com/tutorials/ajaxPage.php?data=" + escape(content), function(){
    $("#loadImg").hide();
    $("#opacityWrap").animate({opacity:1},250)
  });
});</script></p>
<style type="text/css">
div.ajaxWrapper{
margin: 20px 0 0 0;
width: 100%;
height: 75px;
background-color: white;
border: solid 1px #555555;
}
#loadImg{
display: none;
position: relative;
z-index: 1000;
top: 32px;
margin: 0px 0px -32px 305px;
}
#fillBox{
margin: 10px;
color: #555555;
text-align: center;
}
input#entryField
{
float: left;
height: 25px;
width: 200px;
font-size: 16px;
font-weight: bold;
border: solid 1px #444444;
padding-left: 5px;
}
input#theButton
{
float: right;
color: White;
font-size: 12px;
font-weight: bold;
text-transform: uppercase;
font-family: Arial, Helvetica, Sans-Serif;
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.3);
border: #1D3E66 1px solid;
border-radius: 3px;
background-color: #6284A3;
padding: 5px;
cursor: pointer;
}
input#theButton:hover{ background-color: #1D3E66; }
</style>
</div>
<p>The most useful time for this implementation of AJAX is when you want to communicate with your database to load content that your already rendered page doesn&#8217;t have. This particular example does not actually use any information from a database, but it should get the point across. So now that you know how to implement this, go and do it! Ask questions if you got &#8216;em.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.davidjrush.com/blog/2010/09/ajax-loading-external-content/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>AJAX: Wait Here Just A Minute</title>
		<link>http://www.davidjrush.com/blog/2010/09/ajax-wait-here-just-a-minute/</link>
		<comments>http://www.davidjrush.com/blog/2010/09/ajax-wait-here-just-a-minute/#comments</comments>
		<pubDate>Sun, 12 Sep 2010 14:30:54 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[AJAX Tutorials]]></category>
		<category><![CDATA[User Experience]]></category>
		<category><![CDATA[AJAX]]></category>
		<category><![CDATA[javascript basics]]></category>
		<category><![CDATA[jquery]]></category>

		<guid isPermaLink="false">http://www.davidjrush.com/blog/?p=320</guid>
		<description><![CDATA[The best thing about Ajax is you can get brand new content on a page without having to reload it. The worst thing about ajax is people aren&#8217;t entirely used to waiting for content if they don&#8217;t see a page reload. Well, there is a quick and easy solution for that problem: animated gifs! In [...]]]></description>
			<content:encoded><![CDATA[<p>The best thing about Ajax is you can get brand new content on a page without having to reload it. The worst thing about ajax is people aren&#8217;t entirely used to waiting for content if they don&#8217;t see a page reload. Well, there is a quick and easy solution for that problem: animated gifs! In the beginnings of the web, animated gifs were used to make flashing titles that somehow everyone thought were the bee&#8217;s knees. Now that those are thankfully out of fashion, we can use animated gifs as an indicator that the website is &#8220;thinking&#8221;. The average web user won&#8217;t understand what all this AJAX stuff is doing in the background, all they need is something to tell them to wait just a little bit. Here are a few examples that I created using an awesome <a href="http://www.ajaxload.info/" target="_blank">AJAX loading gif generator</a>:</p>
<p style="text-align: center;"><img class="aligncenter" title="Ajax Loading Image Expanding Circle" src="http://www.davidjrush.com/images/tutorials/expandCircle.gif" alt="" width="32" height="32" /></p>
<p style="text-align: center;">Oooh, that&#8217;s pretty. But maybe something more simple?</p>
<p style="text-align: center;"><img class="aligncenter" title="Ajax Loading Image Small Circle" src="http://www.davidjrush.com/images/tutorials/smallCircle.gif" alt="" width="16" height="16" /></p>
<p style="text-align: center;">I like the simplicity, but it is too circly. Fix it designer!</p>
<p style="text-align: center;"><img class="aligncenter" title="Ajax Loading Image Small Bar" src="http://www.davidjrush.com/images/tutorials/smallBar.gif" alt="" width="16" height="11" /></p>
<p style="text-align: center;">And here&#8217;s a bar that could be used to indicate more of a &#8220;progress&#8221; concept instead of a &#8220;loading&#8221; concept:</p>
<p style="text-align: center;"><img class="aligncenter" style="margin-top: 0px; margin-bottom: 0px;" title="Ajax Loading Image Large Bar" src="http://www.davidjrush.com/images/tutorials/largeBar.gif" alt="" width="220" height="19" /></p>
<p style="text-align: center;">
<p>I can guarantee that you&#8217;ve seen these types of images all over the web, and now you know why. It is possible people will implement these animated gifs for other purposes, but mostly, you&#8217;ll just experience them because of AJAX. Now go have fun making your own!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.davidjrush.com/blog/2010/09/ajax-wait-here-just-a-minute/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>AJAX: What The Heck Is It?</title>
		<link>http://www.davidjrush.com/blog/2010/08/ajax-what-the-heck-is-it/</link>
		<comments>http://www.davidjrush.com/blog/2010/08/ajax-what-the-heck-is-it/#comments</comments>
		<pubDate>Mon, 16 Aug 2010 14:00:45 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[AJAX Tutorials]]></category>
		<category><![CDATA[User Experience]]></category>
		<category><![CDATA[AJAX]]></category>
		<category><![CDATA[javascript basics]]></category>
		<category><![CDATA[jquery]]></category>

		<guid isPermaLink="false">http://www.davidjrush.com/blog/?p=318</guid>
		<description><![CDATA[Ajax is the new web 2.0 fad, and it is probably here to stay for quite some time. AJAX, or Asynchronous Javascript and XML, is a method used to communicate with the server and load new content in a website without having to reload the page. You&#8217;ve probably seen it all over the web, but [...]]]></description>
			<content:encoded><![CDATA[<p>Ajax is the new web 2.0 fad, and it is probably here to stay for quite some time. AJAX, or Asynchronous Javascript and XML, is a method used to communicate with the server and load new content in a website without having to reload the page. You&#8217;ve probably seen it all over the web, but possibly without necessarily thinking about what it is. The minor difference makes a huge positive impact on users, and a pretty negative impact on page impressions.</p>
<p>So what type of things would AJAX come in handy for? Well a very common implementation is for search tools. Say you are on a site looking for houses and there are tons of criteria you can enter in to narrow down your search. It is really helpful to see how each change in your criteria affects your results. To offer constant feedback, web developers need to use AJAX to bring back search results each time you change criteria. If they didn&#8217;t use AJAX, you&#8217;d be staring at a page reload every time, and that&#8217;d be mindbogglingly annoying&#8230;</p>
<p>A great example is a search tool I worked on at my company, College Prowler. The tool is meant for high school students trying to find colleges that fit their criteria of where they want to attend a college. Test it out and see for yourself <a href="http://collegeprowler.com/finder/" target="_blank">here</a>. The telltale sign of AJAX by the way is one of those circling gifs to indicate something is loading, so keep an eye out for that as you browse the web.</p>
<p>So now maybe you understand the benefits of AJAX. It makes for a much more fun and usable experience for users as they traverse your website. The serious downside is a decrease in your pageviews. Every time you make an AJAX call, you lose what would have been a new page load and thus a new pageview. With each pageview (if you know what&#8217;s good for you AND have a highly trafficked website), you gain ad income. Now you could argue that with the improved user experience, you&#8217;ll make up for the lost pageviews in your AJAX tool with more devoted users (an argument I agree with), but that doesn&#8217;t cut it for everyone.</p>
<p>So make the choice to go with AJAX. In an upcoming post, I&#8217;ll write about the basics of AJAX and how to implement it.<br />
Cheerio!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.davidjrush.com/blog/2010/08/ajax-what-the-heck-is-it/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Javascript: Opportunities Abound</title>
		<link>http://www.davidjrush.com/blog/2009/05/javascript-opportunities-abound/</link>
		<comments>http://www.davidjrush.com/blog/2009/05/javascript-opportunities-abound/#comments</comments>
		<pubDate>Tue, 19 May 2009 13:00:02 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[Javascript Tutorials]]></category>
		<category><![CDATA[image sliders]]></category>
		<category><![CDATA[javascript basics]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[lightboxes]]></category>

		<guid isPermaLink="false">http://www.davidjrush.com/blog/?p=120</guid>
		<description><![CDATA[Javascript is a useful coding language that creates &#8220;client-side&#8221; changes to a website. It is really a great tool for simple and yet amazing interactivity on your website. Now for those of you who are used to only coding with HTML and CSS, Javascript will be quite a jump for you. Where HTML and CSS [...]]]></description>
			<content:encoded><![CDATA[<p>Javascript is a useful coding language that creates &#8220;client-side&#8221; changes to a website. It is really a great tool for simple and yet amazing interactivity on your website. Now for those of you who are used to only coding with HTML and CSS, Javascript will be quite a jump for you. Where HTML and CSS apply simply to content and layout, javascript can be very heavy on logic, something that typical computer programming is founded on. So be aware that JS could be a very big change for you.</p>
<p>So what can you do with JS? You can automatically rotate through images, or let users rollover thumbnails to enlarge a main photo. You can change text or even the styles that apply to text or other layouts. You can apply a simple watermark to a text box to indicate what users should do with it. You can sort tables or have fantastic animation effects to coincide with user actions. Have you ever encountered a popup window that greys out the background? Yep, that&#8217;s javascript (often combined with a few other fancy things such as AJAX, but no need to worry about that). There are really an endless number of options, many of which are pre-written to make your life easier! Here are some great resources for pre-written JS:</p>
<p><strong>1. JQuery and JQuery UI</strong> are fantastic libraries of pre-written javascript. <a href="http://jquery.com/" target="_blank">JQuery</a> is an open-source (free for the masses) series of core JS files.The public then uses this open source base to build <a href="http://plugins.jquery.com/" target="_blank">plugins</a> that can do everything you could possibly imagine for client-side scripting. I&#8217;ve used jquery plugins on <a href="http://collegeprowler.com" target="_blank">collegeprowler.com</a> for a content slider and table sorting just to name a few items. <a href="http://jqueryui.com/" target="_blank">JQuery UI</a> is a subset of JQuery that focuses on very cool animation effects. I&#8217;ve used this (again at College Prowler) to implement an accordion (multiple items where only one is visible at a time), sliding content boxes open and closed, and selection sliders, again to name a few. Great tools, and incredibly easy to implement! Be aware though, because it is open source, a lot of the plugins you end up using can be very finicky on your site&#8230;</p>
<p><strong>2. Carousels and Content Sliders</strong> are a great way of exposing users to a lot of content without overpowering them with options. A lot of people choose Flash for the same purpose, but flash is awful for SEO purposes, is limited because not all of your users will have it installed on their computer, and is more difficult to update. I&#8217;ve found two great carousels that can be applied to either photos or content, and have a lot of customization abilities. Check out <a href="http://sorgalla.com/jcarousel/" target="_blank">jcarousel</a> by Jan Sorgalla, or for a slightly lighter version (the one I ended up using) take a look at <a href="http://www.gmarwaha.com/jquery/jcarousellite/" target="_blank">jcarousellite</a>. Another one I&#8217;ve found out there is at <a href="http://cssglobe.com/post/3783/jquery-plugin-easy-image-or-content-slider" target="_blank">cssglobe.com</a>, which seems pretty sweet as well.</p>
<p><strong>3. Popup Boxes</strong> are one of the best javascript tools you&#8217;ll ever find. They also are one of the only ones you&#8217;ll ever find yourself contemplating paying for. Even though most web users hate the idea of popup windows, popup boxes are entirely different. When used in response to a user action, the popup box offers great opportunities for what you can provide your users with, without navigating them away from a page. They can login to a site that requires registration, they can fill out forms without being forced to have the form take up space on the regular page, or they can view slideshows of images, all without feeling like they&#8217;ve left the page that they felt comfortable enough on to click a link. The two best implementations of popup boxes (or shadow boxes or lite boxes as I&#8217;ve also heard them called) are <a href="http://highslide.com/" target="_blank">Highslide</a> and <a href="http://www.nickstakenburg.com/projects/lightview/" target="_blank">Lightview</a>. I have more experience using Highslide, but I think Lightview is very well made and looks gorgeous. I had found Lightview by accident some time ago, and when trying to relocate it for this post, I found a listing of all the JS popups out there <a href="http://planetozh.com/projects/lightbox-clones/" target="_blank">here</a>. Careful, I haven&#8217;t tested any of them.</p>
<p>Those are just a handful of examples of pre-written JS that you can use. In upcoming posts I&#8217;ll write a little bit about simple JS that you can implement easy peasy on your own without any coding background.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.davidjrush.com/blog/2009/05/javascript-opportunities-abound/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

