1

I am working on page layout in SharePoint 2016 on prem, and using jquery for some simple manipulation.

I need to load my .js - file in edit mode panel only. I reference the .js-file like this in the page layout:

<PublishingWebControls:EditModePanel runat="server">
        <!-- Styles for edit mode only-->           
        <script type="text/javascript" src='http://absolutepath/Style%20Library/myScript.js'></script>
    </PublishingWebControls:EditModePanel>

This is my jQuery code:

$(document).ready(function() {
$('input[title="Til"]').click (function () {
    alert('clicked');

    $("input[Title='Fra']").attr("disabled", "");

    var checkbox = $("input[id *= 'checkboxrutine']");

    for(let i = 0; i < checkbox.length; i++)
    {
         $('input[id="' + checkbox[i].id + '"]').attr("checked", "checked"); 
    }    
}); // end of click
}); // end of documen tready function

It works in Chrome and FireFox, but only not in IE. I have done iisreset and published the .js - file, and clicked ctrl+f5 hundred times . I cannot even find the script in IE by using the developer tools (f12).

Am I doing anything wrong here with regards to referncing the file ? Or is there any issues with the jQuery code that does not work in IE ? What can I do to make this work in IE ? Please advice.

5

I think your issue is using for(let i = 0 syntax.

It has not worked very well in IE < edge: https://stackoverflow.com/questions/39159669/let-statement-in-loop-doesnt-work-as-expected-in-ie

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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