/    Sign up×
Community /Pin to ProfileBookmark

noscript tag validation issues

I guessed this probably wouldn’t be valid mark-up, but thought I’d give it a try anyway:

[code=html]
<div onclick=”do_something();”>
<h2><noscript><a href=”go-here.html”></noscript>Foo Bar<noscript></a></noscript></h2>
<p>Blah blah blah, yadda yadda yadda.</p>
</div>
[/code]

In case it’s not obvious, I wanted to make the title of the element a link on the off chance JavaScript was not enabled. It actually worked as desired in Firefox, but the W3C validator complained. (It does not like starting an element but not closing it within a <noscript> element.)

So I was just wondering if there was any “better” way to accomplish this that is valid mark-up without becoming an overly complex markup mash-up.

to post a comment
HTML

4 Comments(s)

Copy linkTweet thisAlerts:
@rootJul 18.2014 — Think that this valid.

[code=html]<script>
alert("Support for JavaScript");
</script>
<noscript>
<a href="go-here.html">Foo Bar</a>
</noscript>[/code]


http://www.w3.org/TR/html-markup/noscript.html
Copy linkTweet thisAlerts:
@NogDogauthorJul 18.2014 — To accomplish what I was trying to do while still being totally valid mark-up, I'd have to do something ugly like:
[code=html]
<div onclick="do_something();">
<h2><script type="text/javascript">
document.write('Foo Bar');
</script><noscript><a href="go-here.html">Foo Bar</a></noscript></h2>
<p>Blah blah blah, yadda yadda yadda.</p>
</div>
[/code]

Just seems needlessly ugly and breaking the D.R.Y. principle of programming.

PS: And probably isn't great with text-to speech tools?
Copy linkTweet thisAlerts:
@rootJul 18.2014 — IDK if the <noscript> tags can live at the foot of the document body or not, have you tried that way so its out the way?
Copy linkTweet thisAlerts:
@YashaswiAgrawalJul 19.2014 — Hi all,

In the web-centric world of today, where user attention is growing shorter and shorter (in fact, it’s so

short that I’m not even sure whether you’re still reading this), I’m sure you’ve all wondered about what

design is most effective in capturing user attention. Targeted specifically to tackling this issue, I think this

book is perfect for you, someone who aims to make beautiful and effective designed websites. Find out

more about the book and preorder (for an extremely low price) here:

https://publishizer.com/design-to-delight/
×

Success!

Help @NogDog spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.24,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ,
analytics: Fullres
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Marika,
tipped: article
amount: 1000 SATS,

tipper: @hatem774,
tipped: article
amount: 1 SATS,

tipper: @nearjob,
tipped: article
amount: 1000 SATS,
)...