Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
117
rated 0 times [  122] [ 5]  / answers: 1 / hits: 33319  / 8 Years ago, fri, june 17, 2016, 12:00:00

I'm using Clipboard.js and am trying to get the text in a <td> node using the following:



$('.clipboard').click(function(evt) {
clipboard.copy(evt.target.val()).then(
function(){console.log(success);},
function(err){console.log(failure, err);}
);
});


Obviously .val() is not a valid method on evt.target. What's the correct way of getting the nodes text value using evt here?


More From » jquery

 Answers
57

It should be



$(evt.target).text()

[#61727] Wednesday, June 15, 2016, 8 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
yaquelina

Total Points: 517
Total Questions: 101
Total Answers: 96

Location: Egypt
Member since Tue, Jul 6, 2021
3 Years ago
yaquelina questions
;