Geekzone: technology news, blogs, forums
Guest
Welcome Guest.
You haven't logged in yet. If you don't have an account you can register now.


sleemanj

1525 posts

Uber Geek
+1 received by user: 332


#61605 19-May-2010 16:12
Send private message

Anybody know if there is a way to get this to work as expected...

<style>
input { background-color:green; }
input[name*="_name"][value=""] { background-color:red; }
</style>
<input type="text" name="my_name" value="" />

That is, if the input is blank, the background is red, otherwise it is green.  Without resorting to javascript events.

Seems that in at least firefox and chrome, the value attribute is not updated in the DOM when altering the value of the field?





---
James Sleeman
I sell lots of stuff for electronic enthusiasts...


Create new topic
chiefie
I iz your trusted friend
5877 posts

Uber Geek
+1 received by user: 151

Retired Mod
Trusted
Lifetime subscriber

  #331911 19-May-2010 16:23
Send private message

As you have found out, when the textbox is field, there isn't any trigger to the DOM that the state of the textbox has change. You are inevitably require JavaScript (or make use Jquery event at least) to monitor the state change.




Internet is my backyard...

 

«Geekzone blog: Tech 'n Chips Takeaway» «Personal blog: And then...»

 

Please read the Geekzone's FUG

 




sleemanj

1525 posts

Uber Geek
+1 received by user: 332


  #331984 19-May-2010 21:14
Send private message

Indeed, there is a bugzilla entry for it...
  https://bugzilla.mozilla.org/show_bug.cgi?id=558090
 
Apparently IE does what I would have expected (but have not tested myself).

I have also reported to Chromium which also exhibits the problem...
  http://code.google.com/p/chromium/issues/detail?id=44542&sort=-id&colspec=ID%20Stars%20Pri%20Area%20Feature%20Type%20Status%20Summary%20Modified%20Owner%20Mstone%20OS




---
James Sleeman
I sell lots of stuff for electronic enthusiasts...


Create new topic








Geekzone Live »

Try automatic live updates from Geekzone directly in your browser, without refreshing the page, with Geekzone Live now.



Are you subscribed to our RSS feed? You can download the latest headlines and summaries from our stories directly to your computer or smartphone by using a feed reader.