Add missing form.js for field value update (:focus style)
This commit is contained in:
parent
95cddfe4e2
commit
162063025c
@ -1,5 +1,6 @@
|
|||||||
import './external_links';
|
import './external_links';
|
||||||
import './message_icons';
|
import './message_icons';
|
||||||
|
import './forms';
|
||||||
|
|
||||||
import '../sass/app.scss';
|
import '../sass/app.scss';
|
||||||
|
|
||||||
|
11
assets/js/forms.js
Normal file
11
assets/js/forms.js
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
// For labels to update their state (css selectors based on the value attribute)
|
||||||
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
|
document.querySelectorAll('input').forEach(el => {
|
||||||
|
if (el.type !== 'checkbox') {
|
||||||
|
el.setAttribute('value', el.value);
|
||||||
|
el.addEventListener('change', () => {
|
||||||
|
el.setAttribute('value', el.value);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
Loading…
Reference in New Issue
Block a user