How to find span elements inside paragraph and reverts the selection back in jQuery ?
The purpose of this article is to find the span elements inside the paragraph and reverts the selection back using Jquery. In simple wording, we just have to find the span element. After selecting the span element we have to end the most recent operation i.e selecting the span element and then apply some CSS styling to show the reverting the selection operation was done successfully.
- Create the HTML page with the span element within the paragraph element.
- Using .find() method find all the span element.
- Now revert to the operation of finding the span element.
- At the end apply some CSS to show that the operation has been reverted.
- .Find() method: This method is used to returns descendant elements of the selected element.
- .end() method: This method is used to revert the most recent destructive operation, changing the set of matched elements to its previous state right before the destructive operation
- .css() method: This method is used to sets or returns one or more style properties for the selected elements.
Explanation: The first operation was to find the span element within the paragraph element. The second operation was to revert the selection operation. After that CSS styling is not done on the span element rather it was done on the whole paragraph element.
My Personal Notes arrow_drop_up
Please Login to comment...