I want to add checked option to checkbox if it has an id or value of 2 at runtime using javascript. I tried with following code, but I am unable to check the checkbox. Any ideas?
<div>
        <h4>Filter by Area</h4>             
            <ul id="arealist">
    <li><input type ="checkbox"  id="1" value="1" /> All</li>
    <li><input type ="checkbox"   id="2" value="2" /> some</li>
    <li><input type ="checkbox"   id="3" value="3" /> heavy</li>
    <li><input type ="checkbox"   id="4" value="4" /> more</li>
    <li><input type ="checkbox"   id="5" value="5" /> none</li>
                                            </ul>   </div>
<script type="text/javascript" src="<?=base_url()?>js/jquery-1.6.4.min.js"></script>    
<script type="text/javascript">
$(document).ready(function(){  
var areaname=2; //this value i am getting at run time.
$("#areaname").prop("checked",true);
});
</script>
 
     
     
     
     
    