0

EDIT: My problem was not jQuery.each but innerText ; many thanks Djave!

Yet another question about jQuery.each

http://jsfiddle.net/vL4v696a/

jQuery("div").each(function(){
  jQuery("p").append("<br/>"+this.id+" "+this.innerText);
});

Expected:

un solo
deux duo
...

Unexpected:

un undefined
deux undefined

Why does chrome get this.innerText while firefox cannot? Is it a bug?

Seems related to latests firefox versions.

Any alternative? Thanks by advance.

Cœur
  • 34,719
  • 24
  • 185
  • 251
nicolallias
  • 1,005
  • 2
  • 18
  • 49
  • Use `innerHTML` instead of `innerText`. [They support the proper usage](http://stackoverflow.com/questions/1359469/innertext-works-in-ie-but-not-in-firefox). – chRyNaN Apr 27 '15 at 16:43
  • 1
    Yeah, there are a few inconsistencies between browsers, but also jQuery can help you with this, using things such as `jQuery(this).text()` – Djave Apr 27 '15 at 16:45

0 Answers0