JQuery: How can I get HTML from inside NoScript to display in the differend div tag?

I have a small script that determines if a user is using a specific 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 use this browser, we want to display the div tag and show the HTML from another 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 โ€œunsupportedโ€ text inside the tag <noscript>for users who use this browser (since WMD Markdown does not work properly).

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

+3
source share
2 answers

noscript, javascript chrome. , noscript.

+5

, :

var noscriptContents = $($('noscript').html());
$('.ifChrome').append(noscriptContents);
+8

Source: https://habr.com/ru/post/1783030/


All Articles