简体   繁体   中英

Button inside Div isn't showing with the div

I have a button inside a. The div has an id = "winningMsg". Button has no id.

But only the div text is showing and the button remains hidden.

What am I doing wrong?

 document.getElementById("winningMsg").style.display = "block";
 <div id="winningMsg"> <button type="button" onclick="restart()">Restart</button> </div>

You have to put double quotes to id tag:

<div id="winningMsg">
     <button type = "button" onclick="restart()">Restart</button>
</div>

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