Why in the earth must you have a div inside <scipt> tags?


----- Original Message ----- From: "Nick Fitzsimons" <n...@nickfitz.co.uk>
To: <jquery-en@googlegroups.com>
Sent: Wednesday, September 09, 2009 6:55 AM
Subject: [jQuery] Re: HTML code inside script tag, how access to it with DOM???



2009/9/9 Mariano <mariano.calan...@gmail.com>:

I have an HTML page that looks like this:

<html>
<head></head>
<body>
<script type="text/fbml">
<div id="test">some test</div>
</script>
</body>
</html>

Now I have the will to access to the text inside test div but the code
$('#test').text();
doesn't work, matter of fact nothing is returned.

If my div is dragged outside of script tag, js code return me "some
test" correctly, but alas, div MUST be inside script.


That isn't valid HTML; even if you manage to get it to work in one
browser, it may well behave differently in others. A script element
can only contain script code:
<http://www.w3.org/TR/html401/interact/scripts.html#edef-SCRIPT>

Regards,

Nick.
--
Nick Fitzsimons
http://www.nickfitz.co.uk/

Reply via email to