javascript - Unexpected call to method or property access in IE7/8 -


this sample code:

$(document).ready(function () {     var span = $("*:contains('uniquetext')");     $(span).text("newtext"); }) 

my jquery version v1.11.0;

var span <span> element;

this code works under chrome, firefox, safari , ie9/10/11.

the problem comes in ie7/8, exception thrown on line .text method called.

i found lot of "solutions" none worked me.

what tried:

  • .text() method,
  • .html() method,
  • i tried this: $(span)[0].innertext = "newtext";

nothing seemed work.

any ideas?

var span <span> element;

if case can try this:

var span = $("span:contains('uniquetext')"); 

because * bad use look-up whole dom instead of specific tag.

i don't recommend can try also:

 var span = $("body *:contains('uniquetext')"); 

Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -