I have this and it works fine:
$(document).ready(
highlightTableRow
);
but when I add a second function (see below) the second doesn’t work.
$(document).ready(
highlightTableRow,
attachClickLinkHandlerForRowLink
);
What’s the correnct syntax for adding a second function to my ready function? Thanks.
edit: add syntax errors. (eclipse)
$(document).ready(
highlightTableRow(); **// error:Syntax error, insert ")" to complete Arguments**
attachClickHandlerForRowLink(); **//error: Missing semicolon**
); **// error: Syntax error on token ")", delete this token**
var originalRowBackground;
function highlightTableRow(){
$('[class^="contentRow"]:has(a)').live('mouseenter', enterRowFunction).live('mouseleave', exitRowFunction);
}
function enterRowFunction(){
originalRowBackground = $(this).css('background-color');
$(this).css({'background-color': "#EFE3FF", 'cursor': 'pointer'});
}
function exitRowFunction(){
$(this).css({'background-color': originalRowBackground, 'cursor': 'pointer'});
}
function attachClickHandlerForRowLink(){
$('[class^="contentRow"]:has(a)').live('click', clickRowLink);
}
function clickRowLink(){
window.location = $(this).find("a").attr("href");
} **//error: Missing semicolon**
you could do
also you could change the
$(document).ready()part into$(function()so you would getdoes the same only shorter