JavaScript · Programming

A sample jQuery plugin

An example of a simple jQuery plugin that does some basic form validation. The HTML The HTML is a simple one with just three form fields. <form id="prod_form" method="get" action="#"> <label for="prod-name">Product Name* :</label> <input type="text" name="prod-name" id="prod-name"/> <span class="error" id="prod-name-error"></span><br/> <br/> <label for="prod-quant">Product Quant* :</label> <input type="text" name="prod-quant" id="prod-quant"/> <span class="error" id="prod-quant-error"></span> <br/> <label… Continue reading A sample jQuery plugin

JavaScript · OOP · Programming

Understanding Self Executing Anonymous Functions

Anonymous function is one which has no reference name. For example: function (){}; Creating Self Executing Function Now if we want to make it self-executing then use the following syntax: 1) Wrap the anonymous function within a round brackets. ( function() {…} ) 2) Execute the function by adding the () in the end. (… Continue reading Understanding Self Executing Anonymous Functions