Andy Green
asked on
Highlight changed form field
Hi
I'm looking for a quick and dirty way to change the style on form fields.
There is no need to remember the old value, so if a change is made and then changed back, the highlight still remains.
Must cover text boxes, radios and dropdowns.
JQuery / JavaScript.
Andy
I'm looking for a quick and dirty way to change the style on form fields.
There is no need to remember the old value, so if a change is made and then changed back, the highlight still remains.
Must cover text boxes, radios and dropdowns.
JQuery / JavaScript.
Andy
ASKER
Thanks, I'll give it a try
Andy
Andy
ASKER
Re reading my OP and I may have over simplified this.
If a selection is made on a Radio button list then only the selected needs to be highlighted, not any previously selected ones.
Andy
If a selection is made on a Radio button list then only the selected needs to be highlighted, not any previously selected ones.
Andy
Through jQuery/HTML/CSS live example of CSS Styling Radio Button/checkbox
http://jsfiddle.net/viralpatel/p499h/
Hope this helps
-Kishan
http://jsfiddle.net/viralpatel/p499h/
Hope this helps
-Kishan
ASKER
Hi Ivo
Your code doesn't work. I have this working:
$("input").change(function () {
$(this).addClass('highligh t');
});
$("textarea").change(funct ion () {
$(this).addClass('highligh t');
});
But this applies the highlight to every radio button option that is selected, As per my update I only want the selected one to be highlighted.
Also the text box changes colour, but I'd like to expand this to remove the style if the text box is cleared.
Any help would be appreciated
Andy
Your code doesn't work. I have this working:
$("input").change(function
$(this).addClass('highligh
});
$("textarea").change(funct
$(this).addClass('highligh
});
But this applies the highlight to every radio button option that is selected, As per my update I only want the selected one to be highlighted.
Also the text box changes colour, but I'd like to expand this to remove the style if the text box is cleared.
Any help would be appreciated
Andy
ASKER
This is a JSFiddle example showing the problem.
http://jsfiddle.net/AndyGreen/QVLZN/3/
Can anyone help?
ANdy
http://jsfiddle.net/AndyGreen/QVLZN/3/
Can anyone help?
ANdy
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks - Just what I needed. I got the textbox bit working.
Open in new window
HTHIvo Stoykov