How to find all inputs that don’t have color name and appends text to the span next to it using jQuery ?
Given some input elements and the task is to find all inputs that don’t have the name = “color” and appends text to the span next to it using jQuery. In simple words, we have to find all the input with the name != “color” then we have to append some text next to the span element.
- next() method: This method is used to returns the next sibling element of the selected element.
- append() method: This method is used to insert the specified content at the end of the selected elements.
- Create an HTML page with different input names and at least one name should be color.
- Next select the input which do not have name = “color”.
- Write a message after each span element which does not have name = “color”.
Before clicking the button –
After clicking the button –