The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Style Input when a Value is already loaded

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • #33415


    I used this article to style some inputs on my site:

    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:

    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! :)


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



    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)
  • The forum ‘JavaScript’ is closed to new topics and replies.