ASP.NET AJAX $find method failes when used in jQuery's $(document).ready() method

时间秒杀一切 提交于 2019-12-02 10:54:29

this worked for me with Telerik controls:

$telerik.$(document).ready(function () {
    var tree = $telerik.$find("<%=RadTreeView1.ClientID%>");
});

see this http://www.telerik.com/help/aspnet-ajax/introduction-using-jquery.html

Try using ASP.NET Ajax DOM Ready.

Sys.onReady(function() {
    //DOM is ready to access and use
    var tree = $find('treeId');
});

I have had problems with the telerik controls and ClientIDMode="Static" before. I simply removed this attribute and used $find('<%= Radtree1.ClientID %>') and it worked.

Edit: Following on from the accepted answer, you can set the default $ to use jquery by pointing it to the telerik $.

window.$ = $telerik.$

If you do that on the site.master (or anywhere global) you'll be able to use jquery as normal.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!