0

I have the following Jquery snippet loading at page.load

function appendFileSizes() {
var attachmentSize = $j172("#<%= AttachmentsFileSize_HiddenField.ClientID %>").val();
var uploadControlFileList = $j172("#<%=Attachments_HiddenField.ClientID %>").val().split("|");
var files = attachmentSize.split("||");
files.splice(files.length-1, 1);
for (var i = 0; i < files.length; i++) {
    var fileInfo = files[i].split("|");
    var fileIndex = $j.inArray(fileInfo[0], uploadControlFileList);
    if (fileIndex > -1) {
        var label = document.createElement("div");

        label.setAttribute("class", "contactUsAttachmentFileSize");
        label.localName = "fileSize";
        label.innerHTML = "(" + bytesToSize(fileInfo[1], 2) + ")";
        label.style.fontSize = 10;

        var row = $j172("span.ruUploadSuccess:contains('" + fileInfo[0] + "')").parent().parent();
        if (!row.find("div.contactUsAttachmentFileSize").length) {
            $j172(row).append(label);
            uploadControlFileList.splice(fileIndex, 1);
        }
    }
}

}

Problem is that it works in all browsers except for IE7 where the if ( .find) is not working and my row gets added everytime rather than just once.

1
  • Simple solution: tell your users to upgrade if you detect IE7, and don't re-direct them to your page unless you do detect it. There is no reason for any machine to be stuck on IE7. IE8 is bad enough as it is...
    – VoidKing
    Nov 16, 2012 at 17:42

1 Answer 1

0

If you can find a way to do it in IE7 at all, you can use conditional comments to write script specifically for IE7 (or not [!] IE7, for that matter) that will provide a workable solution across browsers.

http://www.dominicpettifer.co.uk/Blog/32/ie-browser-detection-for-css--using-conditional-comments-

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.