Grow your CSS skills. Land your dream job.

Style Input when a Value is already loaded

  • # July 8, 2011 at 3:09 pm

    Hi,

    I used this article to style some inputs on my site: http://css-tricks.com/6841-textarea-tricks/

    The goal was to modify the style of the input when it’s empty and when it’s filled. I used the first CSS/jQuery snippet listed in the article to accomplish this. The problem I’m running into is that sometimes my pages will load with content dynamically entered into the input on page load. In this case, the javascript in the above article won’t recognize this. And it won’t start modifying the styles until I interact with the input.

    So what I end up with is an input that has, for example, a background image in it and a text value layed over the top of it. Using .focus and .blur allows me to edit my class and make sure this doesn’t happen. But it doesn’t work on page load when the value is already filled.

    Is there a jQuery function that will look to see if a field has content without the user needing to interact with it?

    You can see what I’m working with here: http://www.iavi.com/itemdesc-new.asp?ic=IN5535L

    Use the black tab that’s fixed to the top right corner of the page to pull down the styled inputs. Excuse the incredible messy code! I’m working on it! :)

    # July 12, 2011 at 3:40 pm

    Hate to bump, but I feel like my thread is getting buried.

    Anyone?

    # August 16, 2011 at 5:04 pm

    Did a Google search for a solution to this problem. The #1 result was this page. Which I posted over a month ago. lol

    Anybody out there?

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".