Niek Oosterbeek Niek Oosterbeek - 1 year ago 102
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 :

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download