Also, if its multiple images, you can give the images a class or find them in any CSS way. So if you can find the object, any object using CSS, then you can use that in jQuery.
$("img").click... $("div.someContainer img").click... $("img.classOfImage").click... $("img:first").click //gets the very first one $("img:even".click //gets every other one Check out the "selectors" on the jQuery page...very powerful and fun stuff. http://docs.jquery.com/Selectors Glen On 7/20/07, Andy Matthews <[EMAIL PROTECTED]> wrote:
Easy to do what you want: <img src="someimage.jpg" id="myImage"> $('#myImage').click(function(){ alert('testing'); }); ------------------------------ *From:* jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] *On Behalf Of *Mitchell Waite *Sent:* Friday, July 20, 2007 9:21 AM *To:* jquery-en@googlegroups.com *Subject:* [jQuery] Click to call a fuction? Is there a way to call a jQuery function when someone clicks on an image without making that image a hyperlink. If that is the only way is there something you can put in the href to eliminate the border that hyperlinks make. Thanks Mitch PS I posted this as a question from Goofy last night and no one answered it. Perhaps now that my status has been so graciously elevated and I am planning a jQuery for Dummies book, someone might help me. Here is the previous question Why won't this work. It's so simple. I just want to call a function using the on lick event. I want it to move a div called Panel. I set up the function function advmode() ( $("#Panel").SlideInRight(1000); }; Then inside a table cell with an image for a button I have this simple link <a href="#Javascript;" onclick="advmode()"><img src="images/Advanced Search Button Wide_No.png" width="250" height="25" /> I must be missing something really basic because this does not come close to working. But this does: <a href="#Javascript;" id="PanelButtonOpen2"><img src="images/Advanced Search Button Wide.png" width="250" height="25" /> $('#PanelButtonOpen2').click(function() { $("#Panel").SlideOutRight(1000); }); Thanks for any aid I am feeling very silly tonight. Mitch