简体   繁体   中英

jQuery: hide form submit button but keep functionality

How can I hide the form submit button but keep its functionality (typing Return/Enter in submits form)?

Using .hide() (or display:none via CSS) removes the submit on return functionality.

Instead of using display: none; , use visibility: hidden;

I'm not sure why it would be necessary, but you can use this type of CSS:

http://jsfiddle.net/isherwood/58Y76

input[type="submit"], button[type="submit"] {
    position: absolute;
    left: -999em;
}

This puts an element offscreen without scrollbars.

I used a <button id="tmp"></button> instead of <input type="submit"></input> .

And then in CSS:

#tmp{
  display:none
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM