Friday, May 9th, 2008
I've been asked a few times if Dimensions would provide a method for getting the scrollbar width. In Dimensions 1.0 I created an internal method for finding the scrollbar width to hack around some browser limitations. I eventually found other ways around those limitations and that code is no longer in Dimensions. I know that [...]
Monday, June 25th, 2007
A common question on the jQuery mailing list is: "Where is the hasClass method?". jQuery has a very flexible method named is. This method takes an expression to test against. For example you could see if a particular element is a form element.
$('#myElement').is('form');
This will return true or false if the element is a form or [...]
Sunday, June 17th, 2007
Internet Explorer provides an interesting property called outerHTML. The outerHTML property returns the HTML that composes the whole element, unlike innerHTML which returns the HTML that composes of what is inside the element. None of the other browsers implemented this non-standard property but it can be useful sometimes. So here is a cross browser implementation [...]
Sunday, June 10th, 2007
Internet Explorer provides a handy little method called swapNode. This method allows you to swap one element with another. Now the functionality of swapNode is available in a jQuery method called swap. The swap method can take a selector, an element or a jQuery object. It will take the first matched elements and swap them. [...]
Monday, June 4th, 2007
jQuery provides a method for wrapping an element with one or more elements. This is a really nice method but sometimes you need to wrap the contents of an element. Now you can do so with one method, innerWrap. The innerWrap method acts almost identical to the wrap method. The only real difference is that [...]
Friday, June 1st, 2007
Sometimes you just need to replace one element with another. Of course jQuery makes this easy! You might run this chain to replace one or more elements with a new one.
$('#myElem')
.before('<p>test</p>')
.remove();
This chain simply inserts a <p> tag before the selected element and then removes that element resulting in a replacement. You [...]