TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
venkat
NA
138
51.7k
how to unselect the table column using javascript
Aug 1 2017 2:08 AM
hi all,
i wrote code for select vertical column . what i did is when ever we click on column it will select entire column and we can copy text. now i need to do unselect option . please help me for unselect entire column.
below is my code.
<textarea rows="1" cols="20" id="website" style="display: none;" />
<button data-copytarget="#website" id="btncopy" style="display: none;">copy</button>
function Copytext(obj) {
//debugger;
document.getElementById("btncopy").style.display = "";
document.body.addEventListener('click', copy, true);
document.getElementById("btncopy").click();
document.body.removeEventListener('click', copy, true);
}
function copy(e) {
// debugger;
var table = $("#ValidationStatusTable");
var accountNos = "";
var tbl2 = table.find("tr").each(function (i) {
if ($(this)[0].rowIndex != 0 && $(this)[0].rowIndex != table.find("tr").length-1) {
$(this)[0].cells[0].bgColor = "gray";
accountNos = accountNos + $(this)[0].cells[0].innerText + "\n";
}
})
try {
document.getElementById("website").style.display = "";
document.getElementById("website").innerHTML = accountNos;
t = e.target,
c = t.dataset.copytarget,
inp = (c ? document.querySelector(c) : null);
document.querySelector(c).select();
document.execCommand('copy');
inp.blur();
document.getElementById("website").style.display = "none";
document.getElementById("btncopy").style.display = "none";
}
catch (err) {
alert('please press Ctrl/Cmd+C to copy');
}
}
Reply
Answers (
2
)
Using "GET" command in JavaScript as an "If/Else"
tax calculation