checkbox选中、不选中及事件绑定
//<input type='checkbox' id='checkbox'>
$('#checkbox').is(':checked'); // get check state
$('#checkbox').prop('checked', true); //check the box
$('#checkbox').on('change', function(){
// do something
});
$('#checkbox').on('click', function(){
// do something
});
radiobox选中、不选中及组合
// assume two radio in a group
//<input type='radio' id='radio1' name='radio'>
//<input type='radio' id='radio2' name='radio'>
$('input[type=radio] :checked') //get checked radio in group
$('input[type=radio]').filter(':checked') // get checked radio in group
$('#radio1').prop('checked', true) //check the radio
$('#radio1').is(':checked') //get check state
select选中option及获取值
/*
<select>
<option value='v0'>0</option>
<option value='v1'>1</option>
</select>
*/
$('select option:selected').val() //get selected option value
$('select option:selected').text() // get selected option text
$('select').val() //get selected option value
$('select').text()// get all the options text(01), do not do this
$('select').val('v1') //trigger select to select option with value v1
$('select option:first').prop('selected', true) //select the first option