jQuery: How can I get the HTML from one div to display in another.

Posted by rockinthesixstring on Stack Overflow See other posts from Stack Overflow or by rockinthesixstring
Published on 2011-01-01T22:32:58Z Indexed on 2011/01/01 22:53 UTC
Read the original article Hit count: 126

Filed under:
|
|

I've got a small script that detects if the user is using Google Chrome

var is_chrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1;
if(is_chrome){
    $('.ifChrome').attr('style', 'display:block;');
    $('.ifChrome').html($('noscript > div').html());
};

If they are using chrome, we want to display a div tag and show the HTML from a different div tag inside.

<noscript>
    <div class="note">
        Your browser does not properly support the WMD Markdown Editor.<br />
        Please use <a href="/about/markdown" target="_blank">Markdown<.a> to style your input.
    </div>
</noscript>
<div class="hidden ifChrome note"></div>

What I'm trying to do is show the "not supported" text from inside my <noscript> tag to users who are using google Chrome (because WMD Markdown doesn't work properly with Chrome).

My existing Javascript is not working. Any help would be greatly appreciated.

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery