How do I use an image as a submit button?

后端 未结 6 1337
傲寒
傲寒 2020-12-05 13:08

Can someone help to change this to incorporate an image called BUTTON1.JPG instead of the standard submit button?

6条回答
  •  佛祖请我去吃肉
    2020-12-05 13:28

    Just remove the border and add a background image in css

    Example:

    $("#form").on('submit', function() {
       alert($("#submit-icon").val());
    });
    #submit-icon {
      background-image: url("https://pixabay.com/static/uploads/photo/2016/10/18/21/22/california-1751455__340.jpg"); /* Change url to wanted image */
      background-size: cover;
      border: none;
      width: 32px;
      height: 32px;
      cursor: pointer;
      color: transparent;
    }
    
    
      
    

提交回复
热议问题