How do I submit a form with a
  • instead of a submit button?
  • 前端 未结 6 797
    抹茶落季
    抹茶落季 2021-01-18 10:42

    I want to be able to submit a form but instead of having to click on a submit button, I\'d like to be able to click on an

  • element and have it submit.
  • 6条回答
    •  鱼传尺愫
      2021-01-18 11:05

      I believe I was attempting to accomplish something quite similar to you, but I decided to code it the "correct" way. Here is an alternative approach that basically stylizes the submit button like an li element.

      HTML/Coldfusion

      CSS

      #student_options input[type="submit"] {
          padding:15px 20px 15px 20px;
          font-size:90%;
          color:#555;
          background-color:#eee;
          display:block;
          width:100%;
          text-align:left;
      }
      
      #student_options input[type="submit"]:hover {
          background-color:#F4F4F4;
          cursor:pointer;
      }
      

      You will have to customize elements to your liking, but this is a better approach than using javascript to submit the form.

    提交回复
    热议问题