How to Assign null value to parameter in this function <script type="text/javascript"> $(document).ready(function(){ function alpha_numeric(an) { var TCode = document.getElementById(an).value; for(var i=0; i<TCode.length; i++) { var char1 = TCode.charAt(i); var cc = char1.charCodeAt(0); if((cc>47 && cc<58) || (cc>64 && cc<91) || (cc>96 && cc<123) || (cc==32) || (cc==95)) { } else { alert('Special character are not allowed\n\nPlease enter only alphanumeric and underscore'); //here i want to assign null value parameter or input field(#filcompname) but field name or id is not static it's dynamic or multiple field return false; } } } $('.wrapper .accountinfo .information li.inputs #filcompname').live('keyup',function(){ var an = $(this).attr("id"); alpha_numeric(an); }); }); </script> Code (markup):