Javascript examples for Function:Function Call
Toggle Between 2 Functions
<html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> </head> //w ww .j a v a 2 s. c o m <body> <div id="edit"> <a href="#">EDIT</a> </div> <script> var editAdd = [editList, addList]; function editList(){ console.log('EDIT'); } function addList(){ console.log('ADD'); } $('#edit a').click(function(e){ e.preventDefault(); editAdd.reverse()[0](); }); </script> </body> </html>