How to set value of one input field based on another input field?
问题 I am trying to set the value of slug field by manipulating the input of another field title using JavaScript. When I type in the slug and then again i start typing in the title field the value of slug field doesn't get updated. here is my form document.getElementById('title').addEventListener("input", function(){ let title = document.getElementById('title').value; console.log(title); title = title.toLowerCase(); title = title.replace(/\s+/g, '-'); document.getElementById('slug').setAttribute(