Trabla: js: jQuery public function
Solving:
Create function via
jQuery.myfunction = function( param)
Example:
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> 
</head> 
<body>
 <input value="Click Me 1!" type="button" onclick="jQuery.myFunction1('trololo');" >
<input value="Click Me 2!" type="button" onclick="jQuery.myFunction2('trololo');" > 
<script>
$(document).ready(function(){
  jQuery.myFunction1= function( msg ){
     alert( msg );
 } 
  jQuery.myFunction2= function( msg ){
     alert( msg );
 } 
} 
</script> 
</body> 
</html>
No comments:
Post a Comment