Set an element in the form to not be submitted to the server backend

If it exists for some front-end processing, it does not need to be submitted to the server backend, and the name attribute is not set.

Online testing such as:

<html>
<head>
<script type="text/javascript" src="/jquery/jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
  $("button").click(function(){
    $("div").text($("form").serialize());
  });
});
</script>
</head>
<body>
<form action="">
First name: <input type="text"   value="Bill"   /><br />
Last name: <input type="text" name="LastName" value="Gates" /><br />
</form>

<button>序列化表单值</button>
<div></div>
</body>
</html>

 

Guess you like

Origin blog.csdn.net/qq_37372909/article/details/100187167