1

I've managed to create some code which makes divs appear when the user clicks the navigation buttons.

This works without the html code inside the javascript (which will be the information shown on the pafge when the use clicks a button).

I've had a huge red error come up on my atom and I cant seem to find what I've done wrong. I've tried using Linter too and nothing is coming up.

Can anyone suggest anything?

Here is an image with the error:

the error I'm getting in Atom

here is the code:

$('#myhtmlcss').click( function() {
      $('#content-reveal').fadeOut( 500, function() {
          $('#content-reveal').html( '<div> <h2>HTML AND CSS</h2> <p>Below is example HTML and CSS for the Aguillar Family Wine Festival Schedule website.</p> <br> <p> <textarea name="textareahtml" rows="10" cols="30" readonly> <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Aguillar Family Wine Festival</title> <link rel="stylesheet" type="text/css" href="/examples/winestyle.css" /> <link href="https://fonts.googleapis.com/css?family=Oswal" rel="stylesheet"> </head> <body> <header> <h1>Annual Aguillar Family Wine Festival</h1> </header> <div class="container"> <table> <thead> <tr> <th colspan="2"> <h1>Wine Festival Schedule</h1> </th> </tr> <tr> <th> <h2>Time</h2> </th> <th> <h2>Event</h2> </th> </tr> </thead> <tbody> <tr> <td class="left"> <h3>12:00PM</h3> </td> <td> <h3>Welcome Reception</h3> </td> </tr> <tr> <td class="left"> <h3>1:00PM</h3> </td> <td> <h3>Storytelling & Tasting</h3> </td> </tr> <tr> <td class="left"> <h3>2:00 PM</h3> </td> <td> <h3>Wine Luncheon</h3> </td> </tr> <tr> <td> <h3>3:00PM</h3> </td> <td> <h3>Aguillar Family Wines</h3> </td> </tr> <tr> <td> <h3>4:00PM</h3> </td> <td> <h3>Wine & Cheese Tasting</h3> </td> </tr> </tbody> </table> </div> <footer> <h3>Contact</h3> <h3>Location</h3> <h3>Privacy Policy</h3> </footer> </body> </html> </textarea> <textarea name="textareacss" rows="10" cols="30" readonly></textarea> </p> <p><a href="/example/wineindex.html" alt="Aguillar Family Wine Festival Schedule">CLICK HERE TO SEE THE EXAMPLE ABOVE IN ACTION</a> </p> <p>This site is also another example of my HTML, CSS & SCSS skills. The code for this website, plus plenty of other examples, are on my <a href="https://www.github.com/clarkfennell">GITHUB</a>. </p> </div>' );
          $('#content-reveal').fadeIn( 500 );
        } );
  } );
2
  • 1
    Could you please post the code? As formatted code, not as a picture. It would make it much easier to debug. Commented Aug 5, 2018 at 15:23
  • 1
    I'll edit the post Commented Aug 5, 2018 at 15:24

2 Answers 2

1

For performance reasons, Atom will stop looking at a line when it exceeds ~1000 characters. Fortunately, there are a few options to circumvent this:

Use Tree Sitter

As of Atom v1.25, there's a new experimental parsing system called tree-sitter. You can enable it in the Atom core settings:

enter image description here

Note: You might have to close and re-open your file (or re-assign the grammar) for the changes to apply.

Change Your Code

Alternatively, you can always split up your code into smaller chunks and concatenate them to avoid very long strings. This might also make it easier to maintain.

Sign up to request clarification or add additional context in comments.

Comments

0

This may be caused by the fact you have <html> written inside the .Html tag.

Unless it's inside an iframe, you shouldn't write <html>.

You can escape the brackets using

  • &lt; (<)
  • &gt; (>)

4 Comments

I've adjusted the code and replaced them but it hasn't seemed to have worked
Does the code work if you just replace it with a simple <p>test</p>?
I've added that and it does.
Ok, I guess you just need to figure out what, inside the html is causing it. It's likely the <html> tags :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.