Forum Moderators: open
// Example 1
<script>
function defaultFunc() {
if (document.getElementById('whatever')
document.getElementById('whatever').innerHTML = 'test';
}
</script>
<body onLoad='defaultFunc()'>
<div id='whatever'></div>
</body>
// Example 2
<script>
$(document).ready(function ()
if ($('#whatever'))
$('#whatever').html('test');
});
</script>
<body>
<div id='whatever'></div>
</body>
// Example 3
<script>
$(document).ready(function ()
if ($('#whatever'))
$('#whatever').html(var_1);
});
var var_1 = 'test';
</script>
<body>
<div id='whatever'></div>
</body>