[Solved] Can JavaScript be used to hide some elements within a form?


You can use jQuery to implement this functionality.
You’ll need class of the HTML element and use it to show/hide the data in DOM.
Here is the HTML code:

<button class="btn1">Hide</button>
<button class="btn2">Show</button>
<p>This is a paragraph.</p>

Here is the jQuery code:

$(document).ready(function(){
$(".btn1").click(function(){
    $("p").hide();
});
$(".btn2").click(function(){
    $("p").show();
});
});

solved Can JavaScript be used to hide some elements within a form?