Application Scenario
The basic exercises of jq, but since I am not familiar with jq operation dom, I am used to using vue, so I still need to record the basic exercises of jq, accumulate more and gain more.
jq basic operation - listen to the change event of the input component
1. HTML code
<div class="radioChange">
<label for="type0">
<input type="radio" name="type" value="0" id="type0" checked/>整体
</label>
<label for="type1">
<input type="radio" name="type" value="1" id="type1"/>内贸
</label>
</div>
2. css code
.radioChange{
font-size:20px;
color:#f90;
font-weight:bold;
padding-left:80px;
margin-bottom:8px;
}
.radioChange input {
width:20px;
height:20px;
margin-right:8px;
position:relative;
top:4px;
}
3. js code
var type;
$(".radioChange :radio").on("click", function () {
console.log($(this).val())
type = $(this).val();
//其他方法
})
Finish! ! !
A lot of accumulation, a lot of harvest! ! !