Skip to content Skip to sidebar Skip to footer

Hide Submit Button Using Javascript

How do I hide the submit button using javascript? Reason is because my form checkboxes submits the form on click but only when JS is enabled. For those with JS disabled, I want the

Solution 1:

Why javascript when noscript will do the job:

<form>
.
.
.
<noscript>
<input type="submit" />
</noscript>
</form>

Solution 2:

simple javascript,

<body onload="hideButton()">
<script>
function hideButton()
{
    document.getElementById("buttonId").style.display='none';
    //or you can try
    //document.getElementById("buttonId").style.visibility='hidden';
}
</script>

<input type="submit" value="submit" id="buttonId" />
</body>

Solution 3:

In jQuery:

$(document).ready(function() {
  $('#buttonId').hide();
});


Solution 4:

It is very easy to hide a submit button:

<form method="post/get" action="#">
<input type="Text" name="xyz">
<input type="submit" style="visibility:hidden">
</form>

Post a Comment for "Hide Submit Button Using Javascript"