直接上代码:
<!DOCTYPE html>
<html> <head>
<meta charset=" utf-8">
<style>
</style>
<script src="http://cdn.static.runoob.com/libs/jquery/1.10.2/jquery.min.js"></script>
</head>
<body>
<input type="checkbox">
<input type="radio">
<script>
jQuery.fn.extend({
check:function(){
return this.each(function(){
this.checked=true;
})
},
unchecked:function(){
return this.each(function(){
this.checked=false;
})
}
})
$('input[type="checkbox"]').check();
$('input[type="radio"]').unchecked();
</script>
</body>
</html>