I am new to programming, and I cannot figure out how to save a function in jQuery and run several places in it.
I have:
$(function () { $("div.class").click(function(){
Now 2 "// Doo somethings" match, and I don't want to write the same code again.
If I put:
$(function () { function doosomething () {
This will trigger the function when the page loads, not just when clicked.
How to do it right?
Thank!
function jquery
Corin Jul 28 '09 at 3:41 2009-07-28 03:41
source share