$ find () returns null in IE 9

Sometimes the method $find()

that is in Sys.Application.add_load

returns null

, can someone please help me with this.

note that

  • This is an IE 9 special issue .

  • Sometimes it happens

  • The method $('#id')

    returns the correct jQuery object

  • The element I'm trying to find is SPAN

    insideRadDockZone

  • And the same function $find()

    returns the AJAX component after page load

code

Sys.Application.add_load(gridRefresh_ctl00_contentPlaceHolder_ctl02_2_C_ctl00_GridBooking);

function gridRefresh_ctl00_contentPlaceHolder_ctl02_2_C_ctl00_GridBooking() {
    var gridctl00_contentPlaceHolder_ctl02_2_C_ctl00_GridBooking = $find('ctl00_contentPlaceHolder_ctl02_2_C_ctl00_GridBooking');
    Sys.Application.remove_load(gridRefresh_ctl00_contentPlaceHolder_ctl02_2_C_ctl00_GridBooking);
    if(gridctl00_contentPlaceHolder_ctl02_2_C_ctl00_GridBooking._customData['RefreshOnPageLoad']) 
    gridctl00_contentPlaceHolder_ctl02_2_C_ctl00_GridBooking.refresh();
}

      

+3


source to share


2 answers


I'm not sure if you are using the syntax correctly. See this as an example:

http://jsfiddle.net/turiyag/7wntu/



$("#content").find("#someid").css({border:"5px solid blue"});

      

+1


source


It won't work:

var xyz = $find('ctl00_contentPlaceHolder_ctl02_2_C_ctl00_GridBooking');

      

The method gets the children of each element in the current set of matched elements, filtered by a selector, jQuery object, or element:



var xyz = $('parentSelector').find('descendantsSelector');

      

If it is an identifier that you use as "Selector's descendants" you don't need to find at all, the identifier must be unique, so it only needs to be:

var xyz = $('#ctl00_contentPlaceHolder_ctl02_2_C_ctl00_GridBooking');

      

+1


source







All Articles