This is a migrated thread and some comments may be shown as answers.

How to change background color on client-side?

1 Answer 175 Views
Input
This is a migrated thread and some comments may be shown as answers.
miksh
Top achievements
Rank 1
Iron
miksh asked on 09 Oct 2008, 01:20 PM
I have a requirement to change a background color in RadNumericTextBox to yellow if the value is greater than 5, otherwise use the color defined in the css. How to achieve that?
I used the script below but get_element() returns a reference to a hidden input element.

    <script type="text/javascript">  
        function ClientValueChanged(sender, args) {  
            if (args.get_newValue() > 5)  
                sender.get_element().style.backgroundColor = "#ffee00";  
            else  
                sender.get_element().style.backgroundColor = "";  
        }  
    </script> 

1 Answer, 1 is accepted

Sort by
0
Accepted
Dimo
Telerik team
answered on 09 Oct 2008, 02:11 PM
Hi Michael,

Please use the approach demonstrated at the bottom of this help article:

RadInput Client-side Basics

Let us know if you need more information.

Greetings,
Dimo
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Input
Asked by
miksh
Top achievements
Rank 1
Iron
Answers by
Dimo
Telerik team
Share this question
or