I need help with script tags

I have multiple script tags but they are not working because I know they are styled incorrectly but I cannot find a site that will help me fix them. Can anyone point me in the right direction.

I am trying to add a copy of my code but it isn’t working

<link rel="stylesheet" type="text/css" href="../my-portfolio/main.css"/>
<!--google fonts-->
 <link href="https://fonts.googleapis.com/css?family=El+Messiri" rel="stylesheet">
 <link rel="stylesheet"

 <link rel="stylesheet"
 <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" integrity="sha384-rwoIResjU2yc3z8GV/NPeZWAv56rSmLldC3R/AZzGRnGxQQKnKkoFVhFQhNUwEyJ" crossorigin="anonymous">
 <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>

Are you using codepen?

I am using Atom. I need to get familiar with a text editor. How do I copy my code into the forum? When I paste it in and save it does not show up on my post.

I use Brackets instead of Atom. I’m downloading Atom now to see if I get the same prob. Can you take a screenshot of your code. On Windows you can use Snipping Tool just type “Snipping” when you click the windows icon (see below).

Then you can take a screen shot of just the area you want to post.

Also I did notice that the forums prevented my closing script tag </ to be posted. Prob for security so no one injects malicious code.

ok cool. the last </ script close move it above the new <script open and try it again. I think it’s because it is trying to add a script within a script.

1 Like
    <!-- Scripts to be included for page functionality -->
    <script src="https://code.jquery.com/jquery-3.2.1.min.js" integrity="sha256hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=" crossorigin="anonymous"></script>
    <script src="js/bootstrap.min.js"></script>

I finally installed Atom and was able to post an example (above) of copying and pasting code. Not sure why yours does not work :frowning: sorry.

Thank you for your help.

There are a few problems with your HTML code. The first, related to your SCRIPT tags, is that they’re not supposed to be nested. SCRIPT tags always go on a line by themselves sequentially, and are never nested. The outlined SCRIPT tags in the screenshot below should be deleted.

Second, your existing “valid” SCRIPT tag isn’t properly done. The format of a SCRIPT tag should basically look like this:

<script type="text/javascript" src="[path_to_file]"></script>

Additionally, most of the CSS link tags are also improperly done. The format for a CSS link tag is as follows:

<link rel="stylesheet" type="text/css" href="[path_to_file]">

The <link> tag is not a script and never goes inside a <script> tag. Like the script tag, link tags always go on a line by themselves sequentially and are never nested. Also, they never have more than one href attribute—there’s always only one href per link tag. If you have another link, then you need to write another separate link tag. You can’t “combine” two hrefs into one link tag, it doesn’t work that way.

The only thing that goes between an opening and closing script tag is JavaScript code. Not HTML code as in your screenshot. It seems like that’s where you got confused.

Finally, it’s usually better practice to put your SCRIPT tags at the end of the BODY, and not in the HEAD. That way your page will load before any scripts run.

1 Like

That’s what I needed. :pray:t4:
I was unsure about how to add of the the links.