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

Define new function on $find()

1 Answer 23 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Jocelyn
Top achievements
Rank 1
Jocelyn asked on 29 May 2012, 07:45 PM
Hi, I am using Javascript to resize alot of my control.

I would like to do something like that with a RadTextBox (MultiLine) for example:

$find("myControl").ResizeInput(width, height);

So that, I don't have to pass my control in parameter. I want to use "this" instead inside my function. I don't know if I'm clear enough.

Thanks.

1 Answer, 1 is accepted

Sort by
0
Accepted
Vasil
Telerik team
answered on 30 May 2012, 09:08 AM
Hi Jocelyn,

To define such function place this just after the script manager on your page:
<script type="text/javascript" language="javascript">
 
Telerik.Web.UI.RadInputControl.prototype.ResizeInput = function(width, height)
{
   this._textBoxElement.style.width = width;
   this._textBoxElement.style.height= height;
}
 
</script>

If you want your function to be only for RadTextBox, use RadTextBox instead of RadInputControl in the code above.

Regards,
Vasil
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
General Discussions
Asked by
Jocelyn
Top achievements
Rank 1
Answers by
Vasil
Telerik team
Share this question
or