问题
I have a jQuery instant search bar on top of a data table. All records matching the search condition will be visible $(row).show(); and the rest are hidden $(row).hide().
Problem:
After a search, I use the mice to select / copy the list of rows from search result and paste them into Excel. The "hidden" records also get pasted.
I tried:
$(row).css('visibility','collapse'); instead of hide() -- doesn't work in IE (Row does't collapse)
How do I get "visibility:collapse" work in IE? Or is there a different workaround to this problem?
回答1:
Rather than try to hide the non-visible elements from IE/Windows, I'd suggest having a results table, and cloning the results of your search to that table, and hiding the other. This way the only results available to be selected are the ones that you want to be selected.
来源:https://stackoverflow.com/questions/9648148/dont-let-ie-select-and-copy-table-rows-that-are-hidden-using-jquery-hide