Why does the hover event trigger as soon as the page is loaded?
Because you're calling the function instead of referencing it.
$("#1").hover(showSelector(17), hideSelector);
// ^^^^
Using showSelector(17) as callback to the hover function will call the function first and then assign it's return value to the hover callback. To solve the issue, you can use anonymous function as callback and then call the function inside it with parameters.
function showSelector(position) {
alert(position);
}
function hideSelector() {}
$("#1").hover(function() {
// Use anonymous function
// Call the function with parameter here
showSelector(17);
}, hideSelector);
sup