I am trying to change HTML code within an IFrame (it’s on the same domain), but for some reason, this line, wont change the html:
$('iframe').contents().find('#weergave_afstand').innerHTML = afstand
the text it should modify is the following:
Afstand traject: <span id="weergave_afstand">200</span> km.
But for some reason, it doesn’t.
When I use
$('iframe').contents().find('#weergave_afstand').html()
it reads the value (200) just fine…
What am I doing wrong here?
innerHtml is not a jQuery function, it is an HTMLElement Property.
Usage –> http://www.tizag.com/javascriptT/javascript-innerHTML.php
To write to the inner html using jquery you can use the same html() function which you used for read.