+ 1

How should I remove the border styles added to a textbox(<input type="text">) to make it default textbox

How JavaScript makes textbox to default after adding border styles to textbox

9th Jun 2020, 5:12 AM
Charm
Charm - avatar
4 Answers
+ 3
Charm We are unable to give a proper answer to your question in its current state. Please add more details as Ipang suggested. If you meant the outline when the input gets focused(I'm making a big guess here) : HTML↓ <input id=txt /> Css↓ #txt:focus { outline: none; }
9th Jun 2020, 9:09 PM
Kevin ★
+ 2
What is a default textbox? isn't 'text' the default value for <input> "type" attribute? And what's the need for JS when you can set the preference through CSS? Maybe you can add more description 'cause I feel like a bit lost (didn't really understand you).
9th Jun 2020, 5:40 AM
Ipang
+ 1
If i add border styles to the textbox .How do I remove all border styles added to textbox using JavaScript (i.e on clicking a button) The textbox what I mean is ,the textbox(input box)generated on using the below html code <input type="text">
10th Jun 2020, 6:47 AM
Charm
Charm - avatar
+ 1
Try to set the '<element>.style.borderStyle' to "none" ... For example, assuming the texbox's ID attribute was "text_box"; * HTML <input type="text" id="text_box" /> * CSS #text_box { border: thin solid blue; } *JS (button click event handler) document.querySelector("#text_box").style.borderStyle = "none";
10th Jun 2020, 2:22 PM
Ipang