Question: 3. Write a jQuery script which reads class attribute of the following HTML code and adds text inside the tags based on the value of

 3. Write a jQuery script which reads class attribute of the

3. Write a jQuery script which reads class attribute of the following HTML code and adds text inside the tags based on the value of the class attribute. If the value of class attribute is "blue", then it should add text This paragraph has blue color. If the value of class attribute is "red", then it should add text This paragraph has red color. Tags with no class attribute should remain same. The output may look like as shown below:

Output: This paragraph has blue color This paragraph has green color This paragraph has green color This paragraph has red color

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!