2
0
mirror of https://github.com/frappe/books.git synced 2024-12-23 11:29:03 +00:00

toggleClass helper

This commit is contained in:
Faris Ansari 2018-04-02 22:37:52 +05:30
parent fa612fdeff
commit 2bf226f4c3

View File

@ -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 = '') { toggle(element, default_display = '') {
element.style.display = element.style.display === 'none' ? default_display : 'none'; element.style.display = element.style.display === 'none' ? default_display : 'none';
}, },