Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TypeError HTMLSpanElement has no method 'html'

Tags:

jquery

I get the error

Uncaught TypeError: Object #<HTMLSpanElement> has no method 'html'

When I am running this method

$("input[name=advancedSettings]").change(function() {
  $('span[id^="sFile"]').each(function() {
    this.html('Hey');
  });
});

And span should of course have a method called text and html, and I have tested with both

like image 393
The87Boy Avatar asked Dec 04 '11 20:12

The87Boy


1 Answers

You should run .html() on a jquery object:

$(this).html('Hey');
like image 149
PeeHaa Avatar answered Sep 23 '22 19:09

PeeHaa