rob5300
rob5300

Reputation: 137

HTML page encoding problems

I am having some trouble with a website I am creating, I am using Adobe Dreamweaver to just write code in, not using its visual builder. I have code like this in the file:

<button type="button" onclick="addToCart("box")">Add to cart</button>

But when I view this in Firefox and Internet explorer, when I inspect the page using Firefox the code turns to this:

<button pens")"="" onclick="addToCart(" type="button">

The strange thing is when I view the page source in Firefox it shows up correct.

I did try to also declare the encoding with the meta tag as UTF-8, but no luck (Yes I saved it as this before hand in just notepad).

What can I do? EDIT: Im ashamed of myself for not seeing this myself, but in my opinion Dreamweaver isn't very good as an IDE.

Upvotes: 0

Views: 65

Answers (2)

vanMartijn
vanMartijn

Reputation: 172

This has nothing to do with encoding. Like Munter says, use single quotes.

Viewing the source just shows the code you typed; If you inspect the element you see what the browser thinks you mean, because the code you wrote is invalid.

Upvotes: 1

Munter
Munter

Reputation: 1089

The easiest fix is to use single quotes in your javascript:

<button type="button" onclick="addToCart('box')">Add to cart</button>

Upvotes: 2

Related Questions