开发者

JavaScript innerHTML causing css to disappear on <button>

开发者 https://www.devze.com 2023-01-14 20:15 出处:网络
I havea button tag with two spans inside; <button><span><span id=\"buttonText\">Save</span></span></button>

I have a button tag with two spans inside;

<button><span><span id="buttonText">Save</span></span></button>

I'm trying to make it so that when you click the button the text changes so I have;

onclick="document.getElementById('buttonText').innerHTML = 'Saving...'; this.style.className"

Now funni开发者_StackOverflow社区ly enough it works fine in IE8, but testing in Firefox and Chrome, both lose the css sliding doors styles I have set up on the button and the spans.


How about manipulating nodeValue instead? .firstChild.nodeValue if memory serves me right.

0

精彩评论

暂无评论...
验证码 换一张
取 消