How to find all inputs with a value Green and change the text of next sibling span using jQuery ?
The purpose of this article is to find all the inputs with a value “Green” and changes the text of the next sibling span using jQuery.
Used Methods –
next() method – This method is used to returns the next sibling element of the selected element.
text() method – This method is used to returns the text content of the selected elements.
- Create an HTML page with some input values of different color names.
- Find the input with value = “Green” and changes the text of its next sibling span.
Before clicking the button –
After clicking the button –