如何在jquery中显示用户输入onclick事件

如何在jquery中显示用户输入onclick事件,jquery,onclick,preview,Jquery,Onclick,Preview,我有一个带有不同字段的表单,如radiobutton、checkbox和 列表菜单下拉列表。完成用户输入后,他将单击 按钮式显示预览。那么,如何根据中的选择显示userinput呢 jquery中的onclick事件 <input type = "checkbox" id="stateid" name="stateid" value=""> <input type = "radio" id="gender" value="male"> 我想这个代码可以帮助你 <!

我有一个带有不同字段的表单,如radiobutton、checkbox和 列表菜单下拉列表。完成用户输入后,他将单击 按钮式显示预览。那么,如何根据中的选择显示userinput呢 jquery中的onclick事件

<input type = "checkbox" id="stateid" name="stateid" value="">
<input type = "radio" id="gender" value="male">

我想这个代码可以帮助你

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>name</title>
 <script src="http://code.jquery.com/jquery-latest.min.js"></script>
<script>

 $(document).ready(function(){  
   $('#preview').click(function(){

   $('input[id="stateid"]:checked').each(function() {
        console.log(this.value);
    });


    console.log($('input[id="gender"]:checked').val());


    console.log($('option[id="car"]:checked').val());
 })
 })
 </script>

</head>
<body>
<input type = "checkbox" id="stateid" name="stateid" value="first">first<br />
<input type = "checkbox" id="stateid" name="stateid" value="Second">Second<br/>


 <input type = "radio" name="gender" id="gender" value="male">male
<input type = "radio" name="gender" id="gender" value="female">female
    <br />
    <select id="dropdown">
 <option id="car" value="volvo">Volvo</option>
<option id="car" value="saab">Saab</option>


</select>
     <br />
    <button type="button" id="preview">Show Preview</button>

 </body>
 </html>

检查这把小提琴

展示更多你的表格和你迄今为止所做的尝试。在单击时搜索jquery显示。我建议你也给你的广播组起个名字