I have two span tags inside two divs inside a master div
<div>
<div>
<span id="spanA">start text</span>
</div>
<div>
<span id="spanB">start text two</span>
</div>
<div>
I use jquery 1.7.2 and am trying to get the default text value on the page load for span a & b, then onclick change the value of span a & b and then on toggle change them back.
On FF/chrome this works fine but ie8 is throwing an error
Object doesn't support this property or method
onload
spanAval = $('#spanA').text();
spanBval = $('#spanB').text();
onclick
$('#spanA').text("replace text");
$('#spanB').text("replace text two");
onToggle
$('#spanA').text(spanAval);
$('#spanB').text(spanBval);
in ie8 the text is replaced with “[object]”
I am sure I am missing something basic,
thanks
Art
ok it was something basic, I had the same name for the var as the id
and it failed in ie8 but worked in the other browsers FF/chrome etc , by changing the var name to a unique name it works in ie8
thx for the quick replies