I am having the HTML as shown below. I want to delete the input box and also the image button itself when clicked.
<div id="missioncontainer" class="missioncontent">
<div id="mission-{{mission.id}}" class="contentBox box effectmission" ng-repeat="mission in missions">
<div class="boxheader">
<div style="float:right; clear:right; width:20%;">
<span><a href="" style="" ng-click="deleteMission(mission.id)"><img src="assets/img/delete.png" style="width: 20%; height: 20%;"></a></span>
</div>
<span style="font-size: large; font-family: monospace; font-weight: bold;">EDIT MISSION NAME</span>
<input ng-blur="updatemission(mission.id, mission.missionInfo)" type="text" ng-model="mission.missionInfo" class="form-control" style="background-color: #e8e8e8">
</div>
<div style="padding-top: 10px;">
<span style="font-size: large; font-family: monospace; font-weight: bold; margin-left:5%;">EDIT MISSION POINTS</span>
<br />
</div>
<div style="padding-top: 10px;">
<ul id="beforeul" style="float: left; width: 100%;">
<li ng-repeat="missioncontent in mission.missioncontent" style="padding: 2px; width: 100%;">
<div style="float:right; clear:right; width:20%;">
<span><a href="" style="" ng-click="deletemissionpoints(missioncontent.id, mission.id)"><img src="assets/img/delete.png" style="width: 20%; height: 20%;"></a></span>
</div>
<div>
<input id="{{missioncontent.id}}" type="text" ng-model="missioncontent.info" ng-blur="updatemissionpoints(missioncontent.id, missioncontent.info)" class="form-control" style="background-color: #e8e8e8; width: 80%;">
</div>
</li>
</ul>
</div>
<div style="padding-top: 35px;">
<a href="" ng-click="addmissionpoint(mission.id)"><img id="addmissionpoint" src="assets/img/add.png" alt="addmission" style="width: 7%;height: 12%;float: right; bottom: 0;"></a>
</div>
</div>
</div>
In the "ul" tag, the image and the input box also. I am writing Jquery as shown below, but only input box is getting deleted the image still remains. I need help on selecting the DOM elements using jQuery and calling remove() method on them.
$scope.deletemissionpoints = function(missionpointid, missionid){
alert(missionpointid +" "+ missionid);
jsonData.deletePointId.push(missionpointid);
$("#mission-"+missionid+"").find("li #"+missionpointid+"").remove();
$("#mission-"+missionid+"").find("#"+missionpointid+"").find("img").remove();
};
outerHTMLmight be useful to you. You will have to retrieve the DOM element from Jquery element first. If you are getting an objectundefinederror then Tushar's answer below will helpreadyin the function, remove that