简体   繁体   中英

Remove default display style attribute for html button in javascript

Can you please let me know how to remove a default display style attribute for a input button in JavaScript function. Tried removeAtrribute but no luck.

Thank you in advance.

HTML <input id="myInput" type="text" value="Hello world" style="display:none">

JavaScript document.getElementById('myInput').style.display = "";

As a function

function resetDisplay(element) {
   element.style.display = "";
}

And call that function like this resetDisplay(document.getElementById('myInput'))

JSFiddle

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