Skip to content Skip to sidebar Skip to footer

Html And Internet Explorer: How To Avoid Hidden Elements To Be Copied/pasted

I've a TABLE, in a HTML5 document. I've a view selector who hide/show some rows, using jQuery hide() and show(). When user select the table (programmatically, using a 'select all'

Solution 1:

It seems like this question has been asked before multiple times. (1) - (2)

It seems like there has not been a response that works fine for everyone.

You could use is.(':visible') in jQuery but not sure that translates back to javascript (not very good at it).

Other people have suggested cloning the table and only copying what's in the other table which is hidden, but then that causes a problem later on with other browsers which work fine.

You could use the above method which would work but it's a nasty hack.

There is an answer here which may be of interest to you, however I'm not sure what you're trying to copy and if this is worth the effort.

<joke>

If all else fails, here are some other recommendations:

  • change users

  • force users to change browser

  • render only visible cells and change server code

</joke>

Solution 2:

Nasty hack, but you could:

  • clone the table with js onload somewhere else on the page with a display:none
  • 'Hiding' rows actually removes them from the DOM of the original table
  • restoring hidden rows by replacing from hidden cloned version of table

Post a Comment for "Html And Internet Explorer: How To Avoid Hidden Elements To Be Copied/pasted"