Something makes me crazy, I use the following code (from ajaxUpload to upload images :
Here is the html :
<div class="slide">
<span id="close_btn1" class="del"><a href="#" onclick="return false;">Delete</a></span>
</div>
<div class="slide">
<span id="close_btn2" class="del"><a href="#" onclick="return false;">Delete</a></span>
</div>
and the js :
$('.slide').each(function(){
new AjaxUpload($(this),{
action:"upload",
name:'userfile',
onSubmit:function(file, extension){
do some work..
},
onComplete: function(file, response) {
do some work..
}
});
});
$("#close_btn1").click(function(){
do some work...
});
Images are uploaded when I click on any "slide" div : OK
But if I click on the link Delete : this is the same behavior than if I click on "slide", and the link doesn't work : KO
I would like to exclude this link (class "del") from the for each condition.
I tried :
$('.slide').not('.del').each( ...
also :
new AjaxUpload($(this).not('.del'),{ ...
but it doesn't work..
Any idea?
What I think is happening: the $(this) is referring to the a
element, not to the the span
. Try to put the del class in the a
element
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.