I am working with a video preview system. my source code snippet is
<li id="liVideoList">
<div class="thumbitem">
<div>
<a>
<img alt="" src="images/download.png" onclick="download('ID')" title="Download" />
</a>
</div>
<img class="imagThumb" alt="Thumbs" class="thumb" src="#Path#" />
</div>
</li>
There is a function to preview the video on clicking the li.It is dynamically doing and no issue with that.But if i clik on the download button which is inside the li, both the functions of li and download button is working, which means the preview is changing undesirably. to avoid this I added the below function after the code of dowload
event.stopPropagation();
and the code looks like
function Download(Id) {
$.ajax({
type: "POST",
url: "MyWebMethods.asmx/Download",
data: { "Id": Id}
}).complete(function (data) {
});
event.stopPropagation();
}
but still both the functions are working