Niek Oosterbeek Niek Oosterbeek - 11 months ago 50
HTML Question

Select the html in an 'a' tag with jquery but getting html is not a function


is not a function?

$('a[href*="section"]').click(function() {
var texthtml = this.html();

How do I get the html from an
tag so I can pass it to the next part of the code?

Answer Source

When using this, you can call DOM methods on it, but not jQuery methods. When using $(this), you can call jQuery methods on it, but not DOM methods.

and html() is jQuery method, so :

Change :


To :