mirror of
https://github.com/frappe/books.git
synced 2024-12-23 03:19:01 +00:00
toggleClass helper
This commit is contained in:
parent
fa612fdeff
commit
2bf226f4c3
@ -86,6 +86,18 @@ module.exports = {
|
||||
}
|
||||
},
|
||||
|
||||
toggleClass(element, className, flag) {
|
||||
if (flag === undefined) {
|
||||
flag = !element.classList.contains(className);
|
||||
}
|
||||
|
||||
if (!flag) {
|
||||
this.removeClass(element, className);
|
||||
} else {
|
||||
this.addClass(element, className);
|
||||
}
|
||||
},
|
||||
|
||||
toggle(element, default_display = '') {
|
||||
element.style.display = element.style.display === 'none' ? default_display : 'none';
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user