Created
July 2, 2014 22:24
-
-
Save daneharrigan/b7e2e8731a63d6a68ddc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// this will only affect the input fields that exist in the html prior to this code running. | |
// if your application.js file exists in the <head> tag all of your input fields come after | |
// this code runs so it doesn't see any input fields | |
$("input").on("focus", function(){ | |
console.log("at=first event=focus") | |
}); | |
// similar to at=first but uses $(document) instead of $("input") | |
$(document).on("focus", "input", function(){ | |
console.log("at=second event=focus") | |
}) | |
$(function(){ | |
// same as at=first but wrapped by $(function(){ ... }) | |
$("input").on("focus", function(){ | |
console.log("at=third event=focus") | |
}); | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment