Tribute Page JQuery Unexpected Token Error

Hi all,

I’m attempting to put together my first tribute page and am having an issue targeting a class with a jquery function. I want to place the and

elements within a single white background similar to the example given. I’ve put these into a single div class named “picbed” but seem to get an “unexpected token ;” error on the jquery function. Is anyone able to advise on what this error is?

Thanks!

You’ll need to post some of the code.

Sorry, I thought I had but it doesn’t seem to have shown up.

https://codepen.io/JimmyT91/pen/XEBwzo

@JimmyT,
there is a lot to unpack in your code.

  • You have no JS code in your pen, so it is quite hard to understand to which JQuery function you are referring to

  • You have errors in your HTML markup -> <div class=col-md-6"> You are missing a double quotes symbol at the beginning

  • On a side note, you have a lot of divs and it would help readability if you could add comments as to what div tag is closing what div

Thanks for the response, I tried a different way of working around the problem but the JQuery function I had previously included was:

<script>
 $(document).ready(function() {
$(."picbed").css("background-color", "white");    
  });
</script>

“Unexpected token” almost always means a missing or misplaced semicolon or mismatched brackets/braces/parentheses/quotes .

Just by looking at your code it seems you have misplaced the period of the class picbed. It should be inside the quotes and not outside.

Thanks, I totally missed that. So I tried it with the period in the correct place and now I get the error message “Unexpected Token ILLEGAL”

Hi Randell, I’ve been playing around with the code a bit so may have removed it when you opened the link. I’ve changed it now as was recommended above so it reads:

<script>
$(document).ready(function() {
$(".imgbed”).css(“background-color”, “white”);
});
</script>

It produces the same error I mentioned previously.

If you put it in JS section just remove the script tag.
Edited:
I found that your double quote maybe the problem, I’m not sure that you use it from other Unicode or something
Hope this help :slightly_smiling_face: