1

Can one use jQuery to clone() a meta title? Basically I am trying to grab the Meta Tag Title and put it at the end of some words such as "Related Products for...", "Accessories for...". Below doesn't work but is in for example.

ie:

$('document.title').clone().appendTo('#similar, #suggested');
ToddN
  • 2,901
  • 14
  • 56
  • 96

2 Answers2

1

Try getting the value this way

$("head title").text();
Daniel A. White
  • 187,200
  • 47
  • 362
  • 445
1

If you're just interested in appending the string, why not just use document.title?

$('#similar, #suggested').append( document.title );

Example: http://jsfiddle.net/Uyfae/

user113716
  • 318,772
  • 63
  • 451
  • 440
  • Bingo that worked, it appears as though clone() is only when working with DOM elements. – ToddN Jun 20 '11 at 17:36
  • @ToddN: `title` is a DOM element, but I'd imagine that it is only allowed in the `head`. Anyway, glad it worked. – user113716 Jun 20 '11 at 17:37