<form id="minLengthForm"> <ch5-textinput minLength="10" required feedbackMode="submit"> </ch5-textinput> <input type="submit" /> </form>
var input = document.querySelector('#minLengthForm input[type="text"]'); var form = document.querySelector('#minLengthForm'); form.addEventListener('submit', function(e) { e.preventDefault(); }) input.addEventListener('change', function(e) { console.log(e.target.validity); })
<form id="maxLengthForm"> <ch5-textinput maxLength="20" required feedbackMode="submit"> </ch5-textinput> <input type="submit" /> </form>
var input = document.querySelector('#maxLengthForm input[type="text"]'); var form = document.querySelector('#maxLengthForm'); form.addEventListener('submit', function(e) { e.preventDefault(); }) input.addEventListener('change', function(e) { console.log(e.target.validity); })