change activity buttons added event listeners
This commit is contained in:
parent
fdcdcf1c4c
commit
fc90674ccc
2 changed files with 11 additions and 8 deletions
|
|
@ -1,11 +1,14 @@
|
|||
var archiveButtons = document.getElementsByClassName('archive-button');
|
||||
const archiveButtons = document.getElementsByClassName('archive-button');
|
||||
const activityButtons = document.getElementsByClassName('change-activity-btn');
|
||||
|
||||
for(let i = 0; i < activityButtons.length; i++){
|
||||
activityButtons[i].addEventListener('change', e => {
|
||||
console.log(e.target.checked, e.target.id)
|
||||
})
|
||||
}
|
||||
|
||||
for(let i = 0; i < archiveButtons.length; i++){
|
||||
archiveButtons[i].addEventListener('click', e => {
|
||||
console.log(e.target.id)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
// archiveButton.addEventListener('change', (e) => {
|
||||
// console.log(e)
|
||||
// })
|
||||
|
|
@ -51,9 +51,9 @@
|
|||
<td>{{campaign.active}}</td>
|
||||
<td>
|
||||
<label class="switch">
|
||||
<input type="checkbox" {% if campaign.active %}checked{%endif%}>
|
||||
<input type="checkbox" id="{{campaign.id}}" class="change-activity-btn" {%if campaign.active%}checked{%endif%}>
|
||||
<span class="slider round"></span>
|
||||
</label>
|
||||
</label>
|
||||
</td>
|
||||
<td><button id="{{campaign.id}}" class="archive-button btn btn-primary">Click to archive</button></td>
|
||||
</tr>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue