Hidden text not to be Display OR Selected OR Printed in IE, Jquery


<button id="hide_some_text">Hide</button>
<div id="first">my name is Sea Mist and iam 19 years old</div>
<div id="second" style="display: none">This is the hidden text to be printed and selected only when button is pressed</div>



What i want :

If text under div tag "second" is visible only then it should be SELECTED and PRINTABLE (PLZ note im working in IE) , if text under div tag "second" is hidden then it should not get SELECTED when i do a Ctrl+A -> Ctrl + V and also should not be displayed when i go for Print Preview

Note : im using IE , these problems dont occur in mozzila or chrome , but due to constraints i have to use IE so i need a IE specific solution


Do something like this in your JavaScript:

var cache;
    if($("#second").is(":visible")) { //if it's not hidden
        cache = $("#second").html(); //cache the HTML
        $("#second").hide().html(""); //hide and empty HTML
    else { //else, it's hidden
        $("#second").show().html(cache); //show and get back HTML
$(document).ready(function() {

Need Your Help

Sort the list of objects by alphabet

javascript jquery json sorting

How can i sort the list of elements by alphabet with dividers in Javascript.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.