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

How to retrieve RadNumericTextbox client object using JQuery selector ID ends with

1 Answer 155 Views
NumericTextBox
This is a migrated thread and some comments may be shown as answers.
Matthew
Top achievements
Rank 1
Veteran
Matthew asked on 28 Sep 2020, 06:46 AM

Is there any other way to retrieve the client object of a RadNumericTextbox control without using server tags to get the ID? Otherwise, I always retrieve 'null' as the result of the selector.

E.g.:

$find("div[id$='_numTxt_wrapper']").attr("id"));

I also notice there is a <div> element with an id ending in "_wrapper".

1 Answer, 1 is accepted

Sort by
0
Peter Milchev
Telerik team
answered on 30 Sep 2020, 12:49 PM

Hello Matthew,

You can use some of the Telerik Static Library methods, such as $telerik.findControl(parentElement, controlServerId):

Regarding the NumericTextBox itself, the .control property is set to the input element inside the wrapper element:

<div id="ctl00_ContentPlaceholder1_RadNumericTextBox1_wrapper" class="riContSpinButtons RadInput RadInput_Silk" style="width:190px;">
	<input id="ctl00_ContentPlaceholder1_RadNumericTextBox1" name="ctl00$ContentPlaceholder1$RadNumericTextBox1" class="riTextBox riEnabled" value="1" type="text">
<span class="riSelect">
<a class="riUp" href="javascript:void(0)" id="ctl00_ContentPlaceholder1_RadNumericTextBox1_SpinUpButton">
<span>Spin Up</span></a>
<a class="riDown" href="javascript:void(0)" id="ctl00_ContentPlaceholder1_RadNumericTextBox1_SpinDownButton"><span>Spin Down</span></a></span>
<input id="ctl00_ContentPlaceholder1_RadNumericTextBox1_ClientState" name="ctl00_ContentPlaceholder1_RadNumericTextBox1_ClientState" type="hidden" autocomplete="off" value="{&quot;enabled&quot;:true,&quot;emptyMessage&quot;:&quot;Enter units count&quot;,&quot;validationText&quot;:&quot;1&quot;,&quot;valueAsString&quot;:&quot;1&quot;,&quot;minValue&quot;:0,&quot;maxValue&quot;:70368744177664,&quot;lastSetTextBoxValue&quot;:&quot;1&quot;}">
</div>

 

Also, if you are using jQuery selector, you can search for the .control property of the DOM element.

With that said, the selector you need should be either "input[id$='_numTxt']" or "div[id$='_numTxt_wrapper'] input.riTextBox".

Regards,
Peter Milchev
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
NumericTextBox
Asked by
Matthew
Top achievements
Rank 1
Veteran
Answers by
Peter Milchev
Telerik team
Share this question
or