Works in Firefox but not IE

I use the following to find a string in a specific element, if it exists, check the box. This works fine in Firefox, but not in Internet Explorer (8). It’s hard for me to find a reason.

$.fn.searchString = function(str) {
   return this.filter('*:contains("' + str + '")');
};

var myID = $('div').searchString(files_array[i].substr(-4));

alert(myID);//[object object]

alert(myID.children());//[object object]

myID.children().attr('checked', true);//does not tick checkbox

alert(myID.children().attr('checked'));//undefined

Do IE like the children () function?

Thank you all for your help.

+3
source share
2 answers

From MSDN, citing the function "substr":

Note

If the length is zero or negative, an empty string is returned. If not specified, the substring continues to the end of the line.

You get nothing from the source code that tries to set "myID".

+2
source

. http://dev.jquery.com/ticket/167 . jQuery. , , $("#method-download").get(0).checked = true;.

0

Source: https://habr.com/ru/post/1747351/


All Articles