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

textbox value is cleared on focus

1 Answer 101 Views
Input
This is a migrated thread and some comments may be shown as answers.
Sander Notenbomer
Top achievements
Rank 1
Sander Notenbomer asked on 16 Aug 2010, 09:22 AM
I have a textbox whixh is defined like below.

<telerik:RadTextBox ID="rtbUserName" runat="server" Width="98%" ShouldResetWidthInPixels="false">
</telerik:RadTextBox>

And when i want to set it's value by using jquery. See the following code line.
$('input[id$=rtbUserName_text]').val("Test");

The value is correctly set in the textbox. But when i enter the textbox to change the value. The whole value disappears.

Can someone please tell me if it's possible what i want. Because i don't want to work with client id's.

1 Answer, 1 is accepted

Sort by
0
Accepted
Dimo
Telerik team
answered on 16 Aug 2010, 05:01 PM
Hi Sander,

Generally, this is an incorrect way to set the RadTextBox value, but if you insist on using it, then please add the following line:

$('input[id$=rtbUserName_text]').val("Test");
$('input[id$=rtbUserName]').val("Test");

Normally, the RadTextBox value should be set via the control's client API:

http://www.telerik.com/help/aspnet-ajax/input_clientsideradtextbox.html

http://www.telerik.com/help/aspnet-ajax/input_clientsidebasics.html


Regards,
Dimo
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Input
Asked by
Sander Notenbomer
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Share this question
or