Well, I feel this is probably a school assignment, so I hate to code it for you. Just think about this: when your document loads, make a var called something like "editsMade". Set that to false. Create a function that will change editsMade to true. On your inputs, for the onclick events, call the function that will change your boolean variable to true. On your unload, check to see if editsMade is true or false. Do the appropriate action depending on that. This will suffice your need to see if the user clicked on an input. This will not check to see if the user actually made any changes, but it will warn them changes might have been made, which sounds like all you need.
$("input[type='text'], select, textarea").change(function() < this line fixed me
window.onbeforeunload = function()
return "Your changes may not be saved.";
window.onbeforeunload = null;