click on slider image to do a function in javascript

1.4k Views Asked by At

I am using wowslider for my slideshow. i would like to execute a function when a click is made on a particular image.

<!DOCTYPE html>
<html>
<head>

<meta http-equiv="content-type" content="text/html; charset=utf-8" />

<link rel="stylesheet" type="text/css" href="engine1/style.css" />
<script type="text/javascript" src="engine1/jquery.js"></script>


</head>
<body style="background-color:transparent;margin:auto">


<div id="wowslider-container1">
<div class="ws_images"><ul>
    <li><img src="data1/images/1.jpg" alt="1" title="1" id="wows1_0"/></li>

    <li><img src="data1/images/2.jpg" alt="2" title="2" id="wows1_2" ondblclick="show()" /></li>
    <li><img src="data1/images/3.jpg" alt="3" title="3" id="wows1_3"/></li>
    <li><img src="data1/images/4.jpg" alt="4" title="4" id="wows1_4"/></li>
    <li><img src="data1/images/5.jpg" alt="5" title="5" id="wows1_5"/></li>
    <li><img src="data1/images/6.jpg" alt="6" title="6" id="wows1_6"/></li>
    <li><img src="data1/images/7.jpg" alt="7" title="7" id="wows1_7"/></li>

</ul></div>
<div class="ws_thumbs">
</div>
<div class="ws_shadow"></div>
</div>  
<script type="text/javascript" src="engine1/wowslider.js"></script>
<script type="text/javascript" src="engine1/script.js"></script>


<script type="text/javascript">

function show() {
    window.alert("checked");
}

</script>

</body>
</html>

here is my code. i tried it by adding the doube click attribute on the image. But it is not working. Suggestions are highly appreciated. thanks in advance :)

1

There are 1 best solutions below

2
On BEST ANSWER

Use jQuery to your image id:

$('#wows1_2').click(show); // show is your function

or:

$('#wows1_2').click(function(){ //do something here });