Archive for December, 2008

How to view Expert Exchange password protected answers

Sunday, December 21st, 2008

Has anyone ever search for a solution to a problem in Google to only find that high up on the search results page comes Experts Exchange? I searched for ‘css background image on textarea‘ and low and behold Experts Exchange comes up in 4th position. Just like every other time I am meet with the message:

“View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you’re done.”

I always wondered how they get Google to cache this page if I can’t see it, I even checked Google’s cache view with no luck.

But wait there is a simple solution to this problem…. scroll down to the bottom and BAM there is the answer! I can’t believe I never saw that after 6 years of searching for programming problems.

I hope someone else find this useful. Enjoy!

Technorati Tags: , , ,

Use jQuery to find the first parent element

Saturday, December 20th, 2008

I have run across this problem a few times lately and I thought I would write a post here as a way of remembering how to do it.

So you are doing some DOM Scripting and you want to find the first parent element that has a particular class. I have been using jQuery a lot lately and I initially thought this would be easy:

$('#test').parents('.parent-element');

However, as you notice with the example below you get all the parent elements with the specified class. So all we need to do now is filter out just the first element, like so:

$('#test').parents('.parent-element').filter(':first');

Done and done, see some example code to show it in action: Use jQuery to find the first parent element

I hope someone else finds this useful.

Technorati Tags: , , ,

How to turn off Safari’s textarea expand

Sunday, December 14th, 2008

Apple’s Safari web browser has for a while had the ability for users to drag the bottom right corner of a textarea and resize it to make room for more content.

While resizing textareas creates a nice unobtrusive enhancement, unfortunately it can sometimes break your CSS layout as well. So how can you turn it off? Well you actually have two easy options:

Option 1: Add min and max widths to your textarea so that Safari users can only resize it as far as you will let them.


textarea {
max-width: 300px;
max-height: 300px;
}

Option 2: If you do not want to let a Safari user resize the textarea at all, you can use the resize CSS property.

textarea{
resize: none;
}

Nice and easy - see my example of How to turn off Safari’s textarea expand.

Technorati Tags: , , , ,