Don't let IE select and copy table rows that are hidden using jQuery .hide()

故事扮演 提交于 2019-12-23 16:12:54

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!