I make use of the following to find a string in a particular element, if it exists, tick a checkbox. This works great on Firefox but not internet explorer (8). I am having trouble finding why.
$.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
Does IE not like the children() function?
Thanks all for any help
From MSDN, in reference to the "substr" function:
Remarks
If length is zero or negative, an empty string is returned. If not specified, the substring continues to the end of the string.
You're coming up with nothing from the original code that tries to set "myID".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With