简体   繁体   中英

How to change the span display style, while changing the innerHTML of that span

<span id="spnRef" style="display:none"></span>

I want to make this span visible now. How can I change the span display style, while changing the innerHTML of that span?

document.getElementById("spnRef").style.display = "block";

You cannot make both happen in single line of code.

You will have to execute that line separately.

If plain javascript:

document.getElementById("spnRef").style.display = "block";

If Jquery:

$("#spnRef").show();

Hope this helps.

尝试这个:

document.getElementById("spnRef").style.display = "block";

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM