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><inputtype="submit" /></noscript></form>

Solution 2:

simple javascript,

<bodyonload="hideButton()"><script>functionhideButton()
{
    document.getElementById("buttonId").style.display='none';
    //or you can try//document.getElementById("buttonId").style.visibility='hidden';
}
</script><inputtype="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="#">
<inputtype="Text" name="xyz">
<inputtype="submit" style="visibility:hidden">
</form>

Post a Comment for "Hide Submit Button Using Javascript"