0

Following is a js while i try to save it it shows "The content of elements must consist of well-formed character data or markup." errore , kindly help me to solve this problem

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/modernizr/2.6.2/modernizr.min.js"></script>
<script>
(function(){            

    if ($('html').hasClass('csstransforms3d')) {

        var foldingList = $('.folding'),
            foldingListHeight = $('.folding').height();
            topElemOffset = foldingList.offset().top,
   **===========================================^
    lint warning: multiple statements separated by commas (use semicolons?)**


            // Function responsible for unfolding the list
            unfold = function(){
                setTimeout(function(){
                    if (foldingList.hasClass('folded')){
                        foldingList.removeClass('folded');
                        return;
                    }
                }, 500);
            }

        // Fold/Unfold the list
        $('.connect').on("click",function(){

    **==^
    lint warning: missing semicolon**

            foldingList.toggleClass('folded');
        })
        // If needed, unfold the list right away
        if (topElemOffset <= $(window).height() - foldingListHeight)
            unfold();
    **===^
    lint warning: block statement without curly braces**


        // Check whether to unfold the list when scrolling/resizing
        $(window).on("scroll resize", function(){
            var th = $(this);               
            if (th.scrollTop() + th.height() - foldingListHeight  >=  topElemOffset)
                unfold();
**====^
    lint warning: block statement without curly braces**


        })
    }

})()
</script>
Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433

1 Answers1

0

the error messages are pretty clear.

 topElemOffset = foldingList.offset().top; // ; instead of ,

 ...

 $('.connect').on("click",function(){
        foldingList.toggleClass('folded');
    }); // semicolon was mising

 ...
 //write if-statements like this
 if(expression){
     //dowork
 }
Ruben Verschueren
  • 822
  • 13
  • 28