There is a backbone view and it has some events for particular classes. let's say html will be like this.
<div class=""some1">
<a href="#" class="inner1"> Loaction 1 </a>
<a href="#" class="inner2"> Loaction 2 </a>
<a href="#" class="inner3"> Loaction 3 </a>
// All possible hierarchy goes here , like combination of div , a, span
// and every tag has class
// for classes there will be backbone view
<input class="inputclass" type="text"> // input submission
</div>
and lets say backbone view will be
//sampleView.js
template: '_SampleHtml',
events: {
"click .inner1": "clickinner1",
"click .inner2": "clickinner2",
"click .inner3": "clickinner3",
"click .inner4": "clickinner4",
...
....
......
"click .inputclass": "inpputclass",
},
clickinner1: function() {
//do something
},
clickinner2: function() {
//do something
},
clickinner3: function() {
//do something
},
clickinner4: function() {
//do something
}
inpputclass: function() {
// if input is having one particular condition
// i want to remove all the events i.e only 'onclick ' should not work on view,
//means even if you click 'Loaction 1 ' , respective event should not occur
// and contents should be present on DOM
}
I tried "unbind()","off","stopListening()","delegate events in Backbone". nothing has worked for my criteria. when I used delegates, contents are removing from DOM. Is there any method to remove all events which comes under particular div. like "some1"?
P.S: I am attaching an image, where I occurred this problem. Please follow to get exact idea.
afterrender
function in backbone... like i said earlier,undelegateEvents
removes events and does not remove view from DOM, if that is happening it has to do with the code inside your project, which we can't see and hence we can't solve your problem unless you share a minimal reproducible example... – T J