Demo of function executing on click





HTML

<input type=button id=b1 value='Show' onclick="my_function('hi')";>

jquery


<script>
$(document).ready(function() {
////////////////
my_function=function my_function(str){
$('#d1').html(str);
}
////////////
})
</script>