If you want to write javascript function code directly in the onclick event handler declaration instead of using a separate function for that code, you can do it as follows:
<input type="button" value="Save" onclick="javascript:(function(){ //your code; })();"/>
2 comments:
Hey Prashant,
Very useful code for calling very small function directly.
Hi Prashant,
Really very helpful for calling javascript function with one or two line. No need to make a function outside.
Great work...
Post a Comment