Click function firing on pageload?
try changing to this. You are invoking click accidentally
$(function() {
$('#saveBtn').click(function (){
save()});
});
Try changing your script to:
$(function() {
$('#saveBtn').click(save);
});
function save(){
alert('uh');
}
By having brackets in the click
declaration you are calling the function. If you just use the function name then you are providing a reference to the function instead of a call.
Calling with variable
If you are calling the function with a variable you would need to make use of a closure (assuming that you have access to the variable when declaring the event
$(function(){
var foo = 'bar';
$('#saveBtn').click(
function(){
save(foo);
});
function save(message){
alert(message);
}
For more information on closures check out How do JavaScript closures work?.