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


1474 posts

Uber Geek

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

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

input { background-color:green; }
input[name*="_name"][value=""] { background-color:red; }
<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
I iz your trusted friend
5877 posts

Uber Geek

Retired Mod
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



Free kids accounts - trade shares and funds (NZ, US) with Sharesies (affiliate link).

1474 posts

Uber Geek

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

Indeed, there is a bugzilla entry for it...
Apparently IE does what I would have expected (but have not tested myself).

I have also reported to Chromium which also exhibits the problem...

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

Create new topic

News and reviews »

Samsung Announces Galaxy AI
Posted 28-Nov-2023 14:48

Epson Launches EH-LS650 Ultra Short Throw Smart Streaming Laser Projector
Posted 28-Nov-2023 14:38

Fitbit Charge 6 Review 
Posted 27-Nov-2023 16:21

Cisco Launches New Research Highlighting Gap in Preparedness for AI
Posted 23-Nov-2023 15:50

Seagate Takes Block Storage System to New Heights Reaching 2.5 PB
Posted 23-Nov-2023 15:45

Seagate Nytro 4350 NVMe SSD Delivers Consistent Application Performance and High QoS to Data Centers
Posted 23-Nov-2023 15:38

Amazon Fire TV Stick 4k Max (2nd Generation) Review
Posted 14-Nov-2023 16:17

Over half of New Zealand adults surveyed concerned about AI shopping scams
Posted 3-Nov-2023 10:42

Super Mario Bros. Wonder Launches on Nintendo Switch
Posted 24-Oct-2023 10:56

Google Releases Nest WiFi Pro in New Zealand
Posted 24-Oct-2023 10:18

Amazon Introduces All-New Echo Pop in New Zealand
Posted 23-Oct-2023 19:49

HyperX Unveils Their First Webcam and Audio Mixer Plus
Posted 20-Oct-2023 11:47

Seagate Introduces Exos 24TB Hard Drives for Hyperscalers and Enterprise Data Centres
Posted 20-Oct-2023 11:43

Dyson Zone Noise-Cancelling Headphones Comes to New Zealand
Posted 20-Oct-2023 11:33

The OPPO Find N3 Launches Globally Available in New Zealand Mid-November
Posted 20-Oct-2023 11:06

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.