On Wed, Sep 9, 2009 at 6:08 AM, Mariano <mariano.calan...@gmail.com> wrote:
>       <script type="text/fbml">
>           <div id="test">some test</div>
>       </script>
> 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.

The contents of the script tag aren't part of the DOM...but they are
part of the script tag, which itself is part of the DOM.

So slap an id on that script tag and you can grab the contents.  You
can put the contents into a jQuery call and use .find() or related
methods to snag what you need.

I'm a big fan of doing this in small controlled blocks to avoid
embedding lots of HTML into my javascript, but it does take some
practice to find the correct balance between useful separation and
unnecessary/unhelpful separation.  Like you I do NOT label it with
text/html - while that might work now, text/html might end up a known
definition at some time, changing behavior.

-- 
Brett Ritter / SwiftOne
swift...@swiftone.org

Reply via email to