[jQuery] Clicking an image and changing a div's html content.
Hello,
I'm new to jQuery and i'm trying to solve a rather simple problem.
I'd like to create an image that when clicked changes the html of a
div. I'd like to have many different images that change the content of
many different divs with different html.
I've currently figured out how to do it using:
$(document).ready(function(){
$("img.div1").click(function(){
$("#div1").html("<strong>cool this is bold</strong>");
return false;
});
});
However I'd like to be able to use the same function and pass
different parameters into it.
Example, but doesn't work.
function changehtml (divid,content) {
// blah blah
}
then on the image onclick = changehtml("div1","<strong>cool this is
bold</strong>");
Any help is apprechiated!
Best Regards,
Jordan Berry