0

Is there a way to insert [ oninput="this.nextElementSibling.value = this.value" ] through JQuery or Javascript to an input field?

<input aria-label="Quantity" size="4" max="10" min="1" value="1" type="range" step="1">
<output>1</output>

1

1 Answer 1

1

Just set up an event listener for the input event.

document.querySelector("input").addEventListener("input", function(){
  this.nextElementSibling.value = this.value;
});
<input aria-label="Quantity" size="4" max="10" min="1" value="1" type="range" step="1">
<output>1</output>

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.