Wrap it in a jQuery wrapper. .text() is a jQuery method, and your e element is a simple Javascript DOM element, so you need a jQuery wrapper.
var t = $(e).text();
Side note: unobtrusive event handler assignments are preferable to built-in handlers. For instance:
$(document).ready(function(){ $('p').click(function(){ var t = $(this).text(); console.log(t); }); });
The above example uses jQuery to assign a click handler (instead of inline Javascript), and therefore because of this, the element can be accessed in this for a simple Javascript object or $(this) for a jQuery object.
source share