单击复选框重新加载div

Is it possible for me to reload a div when a checkbox in the same document is clicked?

<html:checkbox property="checkbox" styleId="checkbox">
<div id="divToBeRefreshed">
    //content
</div>

I'd rather do it using pure javascript but ajax is ok too if there isn't another solution.

try this

 $("#checkbox").on('change',function(){
       $("#divToBeRefreshed").html('your content');
 });

Well the answer by @karthick is for change event it will reload the content if the checkbox is unchecked also you can use the below code

$('#checkbox').change(function(){

    if($(this).is(':checked')){
        // Checkbox is checked.
        $("#divToBeRefreshed").html('your content');
    }else{
        // Checkbox is not checked.
    }   

});

make your id of checkbox is set to

id='checkbox'

Hope this help you

The change event is sent to an element when its value changes. This event is limited to <input> elements, <textarea> boxes and <select> elements. For select boxes, checkboxes, and radio buttons, the event is fired immediately when the user makes a selection with the mouse.Hope this is what u meant mate

HTML

<input type="checkbox" name="vehicle" value="Bike">I have a bike<br>
<input type="checkbox" name="vehicle" value="Car">I have a car 
<div id="divToBeRefreshed">

</div>

JS

$("input[name=vehicle]").on('change',function(){
      $("#divToBeRefreshed").html($(this).val());
 });

if you want to fire an event when a checkbox is checked / unchecked: use the below code too.

if( $(this).is(':checked') )

Fiddle

http://jsfiddle.net/BzgrW/