mardi 26 juillet 2016

How to get the text/html value from event.target using jQuery

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?

Aucun commentaire:

Enregistrer un commentaire