<script> $(document).ready(function(){ $('#<?=$row['type'] ? 'imagen' : 'video'?>').attr("checked", "checked"); }); </script>