jquery - How to remove button present in other section -
i have html .
<div id="restmenu" class="restmenu"> <ul> <section id="locationx" class="ulsewrap lielement"> <div class="intit">locationx<span class="indelete"></span></div> <ul class="restlistings"> <div class="inner-intit"> <sub class="sub">your favorite restaurant</sub><br> <li> <h6>swaghat</h6> <p>madhapur , near policstation,hyderabad</p> <span class="indelete indeletesub"></span> </li> </div> <input type="button" location="locationx" name="btn1" class="btn btn-success addnewrestaurant" value="locationx"> </ul> </section> <section id="softsol" class="ulsewrap lielement"> <div class="intit">softsol<span class="indelete"></span></div> <ul class="restlistings"><input type="button" location="locationx" name="btn1" class="btn btn-success addnewrestaurant" value="locationx"></ul> </section> </ul> </div>
i need remove button present in softsol location
i tried way
var locationname = 'softsol'; $("#restmenu").find('section').not("#"+locationname).find('.addnewrestaurant').remove();
but not removing button .
could please let me know whats issue ?
i still having problem , couldn't able remove buttons present in other section name addnewrestaurant
this code
function showrestaurantdetailsbylocation(responseeee,locationname) { var ulhtml = $('<ul class="restlistings"></ul>'); var divhtml = $('<div class="inner-intit"><sub class="sub">your favorite restaurant</sub></div>'); divhtml.append('<br>'); for(var i=0;i<responseeee.length;i++) { divhtml.append('<li><h6>'+responseeee[i].name+'</h6><p>'+responseeee[i].address+'</p><span class="indelete indeletesub"></span></li>'); } ulhtml.append(divhtml); $('.restlistings').empty(); $("#"+locationname).append(ulhtml); $("#restmenu").not("#"+locationname).find('.addnewrestaurant').remove(); var $newbutton= $('<input/>').attr({ type: 'button', location:locationname , name:'btn1', class:'btn btn-success addnewrestaurant',value:locationname}); $('.restlistings').append($newbutton); $(".restlistings").show(); $("#restmenu").show(); }
to remove button present in softsol
location this:
$("#restmenu").find("#"+locationname).find('.addnewrestaurant').remove();
currently you're using not("#"+locationname)
, removing other button, , remove other buttons class addnewrestaurant
within restmenu
element not in element id=softsol
.
Comments
Post a Comment