Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 989577
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T05:48:55+00:00 2026-05-16T05:48:55+00:00

I have run the following through JSLint: $(document).ready(function() { /* Add paragraph on page

  • 0

I have run the following through JSLint:

$(document).ready(function() {

    /*
        Add paragraph on page load
    */

    // Get all header elements
    var header = document.getElementsByTagName('h1'),
        parent,
        newP,
        text;

    // Loop through the elements
    for (var i=0, m = header.length; i < m; i++) {
        parent = header[i].parentNode;
        newP = document.createElement("p");
        text = document.createTextNode('This paragraph was inserted with JavaScript!');
        newP.appendChild(text);
        // Insert the new P element after the header element in its parent node
        parent.insertBefore(newP, header[i].nextSibling);   
    }

    // so much easier with jQuery!
    //$('.section > h1').after('<p>I am a new paragraph &amp; I have been added to the page with javascript!</p>');

    /*
        Toggle show/hide
    */

    // display show/hide link - hidden by default if JS disabled as functionality is not available
    $('#content > .section > h2 > a').removeClass('hide');

    // hide What's new on page load - all content will be available if JS disabled  
    $('#content > .section > ul').addClass('hide');

    // show/hide content on click event
    $('#content > .section > h2 > a').live('click',function() {

        $('#content > .section > ul').toggle();

        return false;

    });

    /*
        JSON
    */

    var $jsonURL = 'scripts/response.json';

    $.ajax({
        type: 'GET',
        url: $jsonURL,
        dataType: "json",
        success: function(data){

            $.each(data.data, function(i, data){

                var $html = '';

                var $string = '';

                if (data.type == 'comment') {
                    $string = 'file';
                } else {
                    $string = 'workspace';
                }

                $html += '<li class="' + data.type + '">';

                $html += '<strong>New ' + data.type + '</strong> was added to the ' + $string + ' ';

                $html += '<a href="' + data.target + '">' + data.target + '</a> ';

                $html += '<a href="' + data.workspace + '">' + data.workspace + '</a>';

                $html += ' by <a href="#">' + data.user + '</a>'; 

                $html += '</li>';   

                $('#content > .section > ul').append($html);    

            });

        },
        error:function (xhr, ajaxOptions, thrownError){
            alert(xhr.status);
            alert(thrownError);
        }           
    }); 

});

And am getting this error:

Error:

Problem at line 89 character 4: Mixed spaces and tabs.

}

Implied global: $ 1,31,34,37,39,51,57,81, document 1,8,16,17, alert 87,88

Not really sure how to fix?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T05:48:56+00:00Added an answer on May 16, 2026 at 5:48 am

    This error occurs when your indentation uses a combination of both spaces and tabs, for example, {SPACE}{SPACE}{TAB}{SPACE} or {TAB}{SPACE}{TAB}. I’m not really sure why it’s an error and not a warning, but the solution is to revisit the line and make sure you only use spaces OR tabs.

    The problem with mixing tabs and spaces is you could run into indentation issues when the file is viewed in a different application. For instance, one user may have tabs configured to equal two spaces, another could open the first user’s file and see uneven indentation because two spaces plus one tab equals 6 spaces as opposed to 4 in the first’s app. Using one or the other ensures better readability of your code.

    Interestingly enough, Stack Overflow normalizes tabs into 4 spaces, so copying and pasting your code from here back into JSLint fixes the problem.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.