SOURCE

console 命令行工具 X clear

                    
>
console
// ----------------------------------text
console.log($("input:text").val())
console.log($(":text").val())

$("input:text").val("changed")
$(":text").val("changedlast")


// ----------------------------------radio
console.log($("input[type='radio']:checked").val())
console.log($(":radio:checked").val())

$("input[type='radio']").eq(1).attr('checked','checked');
$(":radio").eq(0).attr('checked','checked');

// ----------------------------------checkbox
console.log($("input[type='checkbox']:checked").val())
console.log($(":checkbox:checked").val())

$("input[type='checkbox']").eq(2).attr('checked',true);
$(':checkbox').eq(1).attr('checked',false);

// ----------------------------------select
console.log($("select option:selected").val())
console.log($("input[type=select]:selected").val())

console.log($(":selected").val())
console.log($("select :selected").val())

$("select").val("河北")
$("input[type=select]").val("河南")

//  ----------------------------------file
console.log($(":file").val())
$("#btn").click(function(){
  console.log($("input[type=file]").val())
	// alert($(":file").val())
  
  $(":file").remove()
})

<!-- <script src="https://unpkg.com/vue/dist/vue.js"></script> -->
<!-- <script src="https://unpkg.com/vue-router/dist/vue-router.js"></script> -->
<form action="">
  <input type="text" value="姓名" name = "xingming"/>
  <p>性别:</p>
  <input type="radio" name="sex" value="男" checked/><label for="">男</label>
  <input type="radio" name="sex" value="女"/><label for="">女</label>
  <p>兴趣:</p>
  <input type="checkbox" name="check" value="足球" checked/><label for="">足球</label>
  <input type="checkbox" name="check" value="篮球" checked/><label for="">篮球</label>
  <input type="checkbox" name="check" value="电影" /><label for="">电影</label>
  <input type="checkbox" name="check" value="阅读" /><label for="">阅读</label>
  <p>位置:</p>
  <select name="sele" id="sele">
    <option value="北京">北京</option>
    <option value="河北">河北</option>
    <option value="河南">河南</option>
  </select>
  <p>文件:</p>
  <input type="file" />
  <button type="button" id="btn">获取文件名</button>
</form>

本项目引用的自定义外部资源