Home > Back-end >  How to change display none input inside form?
How to change display none input inside form?

Time:10-18

I have a button this name is manuel. When I click this button I want to change display:none property. Actually, its works but my element inside a form. When I click button form posted. I can't stop the post.

<div class="form-group">
  <input type="text">
  <button onclick="myFunction()" class="btn btn-primary btn-sm">Manuel</button><br>
  <input type="text" style="display:none;" id="hide1">
</div>
function myFunction() {
  document.getElementById("hide1").style.display = "block";
}

How to create input without form post?

CodePudding user response:

Just change button type="submit" to type="button", so you can do display: none function and if you want to submit the form you can do it with javascript.

  • Related