Thanks, Karl.

I didnt know that the title element was treated as a special case and
was selecting it using jQuery's $('title') selector syntax.  That
failed miserably in IE7. Changing my code to use document.title as you
suggested solved the problem.


On Sep 11, 9:08 am, Karl Swedberg <[email protected]> wrote:
> Hi there,
>
> The <title> tag acts a little differently from other DOM nodes. You  
> can just edit the DOM property document.title directly.
>
> $(document).ready(function() {
>         var titleText = document.title;
>         $('#test').val(titleText);
>
> });
>
> --Karl
>
> ____________
> Karl Swedbergwww.englishrules.comwww.learningjquery.com
>
> On Sep 11, 2009, at 7:01 AM, Ezence wrote:
>
>
>
> > Hi,
>
> > There seems to be a problem with using $('title').text() in IE7 and
> > IE8 - wondering if this is a known problem and if there are any work
> > arounds.
>
> > sample code:
>
> > <html>
> > <head>
> >    <title>Example</title>
> >    <script type="text/javascript" src="js/jquery-1.3.2.min.js"></script>
>
> >    <script type="text/javascript">
> >            $(document).ready(function(){
>
> >                    $('#test').val($('title').text());
>
> >            });
> >    </script>
>
> > </head>
> > <body>
> > <input type="text" id="test" />
> > </body>
> > </html>
>
> > It works fine within Chrome and Firefox.

--

You received this message because you are subscribed to the Google Groups 
"jQuery Development" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/jquery-dev?hl=en.


Reply via email to