I picked up a project that another developer built. He has some of the JavaScript on the actual php page which is making debugging difficult.
<button type="submit" onclick="doFunction(event)">Done</button>
I have tried to move it to a javascript file:
$( document ).ready(function() {
function doFunction(e){}
});
and removing it from the PHP page but now it's not firing. Why is it not working now and how do I fix it?
<script src="yourcode.js"></script>? the browser isn't going to magically realize that you moved the code elsewhere.eis undefined within your.ready(). I suggest you look at your js console for errors.<button type="submit" onclick="doFunction(event)">Done</button>or is that the previous solution that you've removed?