Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6936595
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T12:15:15+00:00 2026-05-27T12:15:15+00:00

I have a radTextBox with CssClass=mandatory. In jQuery I have the next thing: $(.mandatory).focusout(

  • 0

I have a radTextBox with CssClass=”mandatory”.
In jQuery I have the next thing:

$(".mandatory").focusout( function () {
  if($(this).val() == "") $(this).css("border", "1px solid #ff0000");
});

The problem is that on focusout, my style is “overwritten” by the classes that the control has by default on different events.
I’ve also tried in jQuery the next thing:

$(".mandatory").focusout( function () {
  if($(this).val() == "") $(this).addClass("mandatoryErr");
});

But still nothing, the class is immediately removed after it was added.
So how can I add style to teleriks control using jQuery?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T12:15:15+00:00Added an answer on May 27, 2026 at 12:15 pm

    The easiest way to accomplish this would be to hook into the various styling options you have on the client using the Client-side API of the RadTextBox. Here’s a snippet that takes essentially your initial code and applies it to the RadTextBox API:

            <script type="text/javascript">
            function ChangeBorder () {
                var textBox = $find("<%= RadTextBox1.ClientID %>");
                if (textBox.get_value() == "") {
                    textBox.get_styles().EnabledStyle[0] += "border-color: #ff0000";
                    textBox.updateCssClass();
                }
                else {
                    //revert back to old CSS
                }
            }
        </script>
    
        <telerik:RadTextBox ID="RadTextBox1" runat="server" ClientEvents-OnBlur="ChangeBorder">
        </telerik:RadTextBox>
    

    The important items to get out of this is that we are subscribing to a client-side event of the RadTextBox (OnBlur). Then we access the RadTextBox client-side object, check if the value is “” or not and then access the styles of the RadTextBox object. There are several different styles, but it seems as if you’re looking for the EnabledStyle. To directly apply some CSS just use the first element of the style array. Alternatively you can apply a CSSClass:

    textBox.get_styles().EnabledStyle[1] += " mandatoryErr";
    

    Where you will be accessing the second element in the styles array. Here you can have mandatoryErr be (for example):

        <style>
        .mandatoryErr
        {
            border-color: #ff0000 !important;
        }
    </style>
    

    The !important tag is just there to increase the specificity of the CSS rule, otherwise it will not be applied (if you’re using the built-in styles).

    If you are looking for more information on all of this, the linked documentation articles should help. You can also use the Chrome Dev Tools and FireBug to inspect the textBox variable above and see what the _styles property holds 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Have you managed to get Aptana Studio debugging to work? I tried following this,
Have converted devise new session from erb to Haml but doens't work, this is
have anyone can tell me what syntax error on this actionscript (actionscript3.0)? var rotY:
Have a look at this url: http://www.trirand.com/jqgridwiki/doku.php?id=wiki:jquery_ui_methods#column_chooser I have got the Column Chooser dialog
have Googled the cr*p out of this one so apologies if the answer is
Have written all the code in a silverlight class library (dll) and linked this
Have some dates in my local Oracle 11g database that are in this format:
I have a radtextbox with double type mode. And i have set round as
I have the following javascript on my page: var isDirty = false; function OnTextBoxValueChanged(sender,
have next code: class GameTexture { private: LPDIRECT3DTEXTURE9 texture; unsigned char *alphaLayer; UINT width,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.