scriptygoddess

Archive for the ‘jquery’ Category

This is a really simple piece of jquery that will launch all external links on the page in a new window. jQuery(document).ready(function(){ jQuery("a[href*='http://']:not([href*='http://yourdomain.com'])").attr("target","_blank"); jQuery("a[href*='https://']:not([href*='https://yourdomain.com'])").attr("target","_blank"); }); Updated to add: Here is a modification in case you want to allow links to subdomains to open in the same window… jQuery("a[href*='http://']:not([href*='http://yourdomain.com'])").not("[href^='http://subdomain.yourdomain.com']").attr("target","_blank"); Another update Here is another modification that […]

08 Aug, 2009

Adding alternate row styles to a table with JQuery

Posted by: Jennifer In: jquery

JQuery's simplicity is so wonderful and powerful. Here's a perfect example. If you have a table, and you want to alternate the row colors. To do so, all you need is this: $(document).ready(function() { $("table.striped tr:nth-child(even)").addClass("altrow"); }); Then, just add class="striped" to your table tag, and jquery will automatically apply add the class "altrow" to […]

A recent project I've been working on involved a portfolio page that required a "carousel" type browser. It also needed to have multiple rows (so that images could be grouped into various projects). Also, because this page would contain a large number of images, it was required that the images not be loaded until you […]

01 Feb, 2009

jQuery Side Scroll

Posted by: Jennifer In: jquery

(This post has been almost completely re-written. Usually I don't that – but I thought it would be more confusing to have all the changes, strikeouts, etc.) For a project I'm going to be working on, I needed to create a navigation piece that had different panes scrolling/sliding in from the right depending on what […]

20 Sep, 2008

Overlapping Tabbed Navigation using CSS and jQuery

Posted by: Jennifer In: CSS|jquery

Recently had a project land on my desk that required tabbed navigation that overlap one another. Just so we're clear on what we're doing: here's the demo. Here is how I did it: 1) Each tab has four "states" – Off, Off (with right tab on), On, On (with right tab on). I combined each […]

Here's a method you can use with the validation jQuery plugin to make sure a field (like a password field) includes at least one number. $.validator.addMethod("atleastonedigit", function(pass) { if (pass == "") { return true; } return ((/[0-9]+/).test(pass)); }, "This field must contain at least one number");

03 May, 2008

Phone number validation with jquery

Posted by: Jennifer In: Javascript|jquery

One of the things I've been playing around with a lot recently is jquery. Why I didn't jump on this bandwagon sooner, I'm not sure, but I am kicking myself for it. So I am still a bit of nub on the jquery front – but I like to think I pick things up quickly. […]

I needed to set the selection of a drop down menu. As far as I can tell, if you don't know the "index" value, then you just have to loop through to set the item as selected. If there's an easier way to do this, please speak up in the comments. I spent WAY too […]


Featured Sponsors

Genesis Framework for WordPress

Advertise Here


  • Scott: Just moved changed the site URL as WP's installed in a subfolder. Cookie clearance worked for me. Thanks!
  • Stephen Lareau: Hi great blog thanks. Just thought I would add that it helps to put target = like this:1-800-555-1212 and
  • Cord Blomquist: Jennifer, you may want to check out tp2wp.com, a new service my company just launched that converts TypePad and Movable Type export files into WordPre

About


Advertisements