Click to See Complete Forum and Search --> : quotes
bean703
12-10-2007, 03:56 PM
<input onclick = 'name.innerHTML = "<input name = First Name
I need to put First Name in quotes but I already used ' and " how can I put another quote?
Escape it:
<input onclick = 'name.innerHTML = "<input name = \"First Name\"
bean703
12-10-2007, 04:12 PM
:( It doesn't work...
Here's what the source code looks like in Firefox:
<input onclick = "name.innerHTML = '<input value = \"First Name\">'"
dtm32236
12-10-2007, 04:17 PM
you can't use "
can you? (I wouldn't think so)
WebJoel
12-12-2007, 08:50 AM
<input onclick = "name.innerHTML = '<input value = \"First Name\">'" " \ " are 'escape characters' which tell the browser to not act upon ("ignore") the next character. So, the "quote semi-quote /semi-quote quote" that are not escaped, are correct as-written.
I think that "name" is one of those 'reserved words' that is expected to have a value (like, name="contentBox", a pre-ID convention which the two are still sometimes both used like id="contentBox" name="contentBox". You see this in javascript sometimes). That is why you see it highlighted in 'danger color' if you validate with TIDY.
If this input isn't working, it's probably something else. But it seems to be written correctly... :confused: