cosmicsafari
cosmicsafari

Reputation: 4049

Toggle code which doesn't appear work in any version of IE?

I have been working on a website over the past few days and it utilises a toggle feature to show/hide some information.

I put together the following piece of jQuery and it seems to do the job perfectly fine in every other browser but IE and to put it simply i'm stumped.

I have tried outputting to the console but its as if IE just ignores the whole thing as there is never any output, anyway i'm curious as to whats going on here.

Any help would be greatly appreciated.

<script type="text/javascript ">
    $(document).ready(function(){
      $(".description_more").click(function(){
         var i=this.id;
         if($(this).html()=='<i class="fa fa-arrow-circle-down"></i> Show more information'){
            $(this).html('<i class="fa fa-arrow-circle-up"></i> Hide information');
            $('#desc_'+i).toggle();
         }else{
            $(this).html('<i class="fa fa-arrow-circle-down"></i> Show more information');
            $('#desc_'+i).toggle();
         }
      });               
    });
</script>

Upvotes: 1

Views: 38

Answers (1)

Colin Wiseman
Colin Wiseman

Reputation: 868

This is IE for ya!

<script type="text/javascript ">

That space after javascript... that's what is breaking it!

<script type="text/javascript">

Will fix it! Love you IE!!

Upvotes: 1

Related Questions