简体   繁体   中英

Using JQuery on SharePoint. Scripts work in a Fiddle on both browsers, but doesn't work on page in IE

Using SharePoint 2010 on-prem. Loading up some JS in a content editor webpart to show some data when a button is clicked. After my first attempt I had it working in Chrome but nothing would happen in IE. It's a simple removeClass function and it is working on my fiddle in both browsers: https://jsfiddle.net/1kqhmL2j/1/ I have had issues using show/hide in the past which is why I'm using a Display: none class. Everything is !important because SharePoint.

Not really sure where to start on the trouble shoot, as most searches of these terms don't seem to get me anything SharePoint specific. Have tried using the JQuery library directly on page as opposed to linked from Google's CDN, played with where it loads on the page, etc. Any help would be hugely appreciated.

The scripts:

$(document).ready(function(){
            $(".but1").click(function(){ 

                    $(".blurb1").removeClass("hidden");


                });
         }); 

$(document).ready(function(){
            $(".but2").click(function(){ 

                    $(".blurb2").removeClass("hidden");


                });
         }); 

$(document).ready(function(){
            $(".but3").click(function(){ 

                    $(".blurb3").removeClass("hidden");


                });
         }); 

$(document).ready(function(){
            $(".but4").click(function(){ 

                    $(".blurb4").removeClass("hidden");


                });
         }); 

$(document).ready(function(){
            $(".but5").click(function(){ 

                    $(".blurb5").removeClass("hidden");


                });
         }); 

使用早期版本的JQuery解决了它-抱歉

In your environment, is basic JavaScript working? ie is it a problem that JavaScript itself is not working, as opposed to just an issue with your script syntax?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM