var id = data.rslt;
var element = id.attr("crawlLocation");
if (element.indexOf("\\") != -1){
var toSearch = element.substring(0,element.lastIndexOf("\\"));
toSearch = "\"" + toSearch + "\"";
}
var stringContent = getInnerHTML('selectedCustodiansForIngestDiv');
if(stringContent.indexOf(toSearch) == -1){
//This loop works fine on Firefox but not in IE8
}
function getInnerHTML(elmtId) {
var innerHTML = "";
if ($gElem(elmtId) != null) {
innerHTML = document.getElementById(elmtId).innerHTML;
}
return innerHTML;
}
In the above code, the if condition with the indexOf
method is not working as expected with IE8, but works fine with other browsers.
In IE8, even if the content in toSearch
is found in the string stringContent
, it goes inside the loop.
I am not sure whether the problem is with indexOf
method or somewhere else in my code. Let me know a way to fix this! Thanks!
UPDATE
I just noticed on debugging that in IE, the toSearch variable is appearing as "\"D:\company\"" instead of "D:\company"(In mozilla and other browsers).
Any idea to overcome this?