Hide submit button on client script

ggggasgasgasgas
Kilo Contributor

Hi.

How can i hide the submit button with a client script?

I use:     this,jQuery('button').hide();

But it hides all buttons and it is a problem in my form, i need hide only submit button

 

Thanks and greetings

 

 

6 REPLIES 6

Shubham52
Giga Contributor

Hi,

All buttons are hiding with  this,jQuery('button').hide();

because you are using button instead for id of that button so it is applicable for all buttons present there.

Try this,jQuery('#button_id').hide();

Mark Correct if it helps.

Nisarg Thakur
Tera Guru

To just hide the submit button, you can try the below in an onLoad catalog client script,

//Get all buttons on form
var buttonQuery = this.jQuery('button');
for (var i in buttonQuery){
	//For each of the buttons, check if the button name is 'submit'
	if (buttonQuery[i]['name'] == 'submit'){
		//Set display to none to hide
		buttonQuery[i].style.display = 'none';
	}
}