Posting as a jquery newbie . I am sure there should be a way to condense the code below in a dry way. Essentially, it's just show / hide, which applies to multiple elements on a page, using all the same templates and naming conventions:
$("#homelink1").hover(
function() { $("#poptext1").show(); },
function() { $("#poptext1").hide(); }
);
$("#homelink2").hover(
function() { $("#poptext2").show(); },
function() { $("#poptext2").hide(); }
);
...
I focused on how to convert this to a function with the parameters passed, so that I could just pass an integer (1 or 2) and evaluate the function of the others, for example.
$("#homelink" + param).hover
source
share