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

后端 未结 3 1329
我在风中等你
我在风中等你 2021-01-26 00:24

I\'m trying to find a tree using ASP.NET AJAX\'s client-side framework. I also use jQuery for doing any JavaScript operation after the DOM is ready. my code is like:

<         


        
相关标签:
3条回答
  • 2021-01-26 01:08

    Try using ASP.NET Ajax DOM Ready.

    Sys.onReady(function() {
        //DOM is ready to access and use
        var tree = $find('treeId');
    });
    
    0 讨论(0)
  • 2021-01-26 01:18

    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

    0 讨论(0)
  • 2021-01-26 01:18

    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.

    0 讨论(0)
提交回复
热议问题