[Koha] Jquery

Owen Leonard oleonard at myacpl.org
Tue Aug 12 00:47:19 NZST 2014


Sorry to have sent an empty reply! Clumsy fingers this morning.

> How would I add multiple statements in opacuserjs. e.g.

You can. You can do multiple document.ready() blocks if you want, or
combine them:

$(document).ready(function(){
  // All the events which will run when the page is ready
  $("#auth legend:contains('Log in to your account')").text("Log in to
your library account");
  $("#auth label[for='userid']").html("Library Card Number:");
  $("#auth label[for='password']").html("PIN:");
  var holdlinks = $("a:contains('Place Hold'),a:contains('Place hold')");
  $(holdlinks).text("Get It Now!");
  $("a:contains('Browse Shelf')").text("See Similar Items");
});

"$(document).ready(function(){" means, "As soon as the page is ready,
run these tasks." You can add as many tasks as you want before closing
the block with "});"

$(window).load(function(){
    // This even will run *after* document.ready because "window" waits
    // for more assets to load completely
    $("input[value='Place Hold']").attr("value","Get  It Now!");
});

I don't think the window.load section necessarily needs to be run
separately, but I don't know what situation it was written for.

  -- Owen

-- 
Web Developer
Athens County Public Libraries
http://www.myacpl.org


More information about the Koha mailing list