7

JQuery: How do I get NoScript HTML to display it in a div div tag?

 3 years ago
source link: https://www.codesd.com/item/jquery-how-do-i-get-noscript-html-to-display-it-in-a-div-div-tag.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

JQuery: How do I get NoScript HTML to display it in a div div tag?

advertisements

I've got a small script that detects if the user is using a certain browser

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 this browser, 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 this browser (because WMD Markdown doesn't work properly with it).

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


You cannot access the content of a noscript-element using javascript in chrome. So you'll have to find a different approach that doesn't use a noscript-element. Read more about that problem here


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK