jQuery: How can I get the HTML from one div to display in another.
- by rockinthesixstring
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.