Question: SHOW AND HIDE INFORMATION USING JAVA I need some help, I need to modify the following code to do the following using JAVA ( I

SHOW AND HIDE INFORMATION USING JAVA

I need some help, I need to modify the following code to do the following using JAVA ( I am not allowed to use JQUERY ) and WITHOUT MODIFYING THE ORIGINAL CODE. I am NOT allowed to add additional HTML or CSS unless the CSS is purely for formatting.

1. I need to create a JavaScript code to show and hide the information when the user clicks on the text. You will also change the text from Show More.. to say Show Less.

2. Use the DOM methods ( getElementsbyTagName(), hasAttribute(), removeAttribute(), setAttribute(), nextElementSibling, previousElementSibling ) as needed, depending on my code.

3. Show and then hide the initially hidden information, changing the text verbiage when the user clicks on h2 element. When the page initially loads, a descendant selector style is set to hide the information. You will be adding a class attribute to show the information using JavaScript. This process is essentially a toggle turning the class attribute on and off - based on if the class attribute is currently set. Not that the class attribute will take precedence over the style set using the descendant selector. #info div { display: none; } #info div.more { /* class to add to show the content - '.more' */ display: block; }

4. I am not allowed to make any modifications to the HTML or CSS code in the provided code. Use the Document Object model properties and methods, with the existing HTML and CSS.

5. We will click Show More and more information will be displayed. The text will change to Show Less. We will click Show Less and the information will disappear. The text will change to Show More.

6. I need a function that executes the code for #2 and #3 when the user clicks on the

.

Here is my based code:

ShowandHideJavaCode

body {

font-family: Verdana, Arial, Helvetica, sans-serif;

font-size: 100%;

margin: 20px;

padding: 10px;

}

section {

margin-bottom: 50px;

}

footer p {

border-top: 1px solid #000;

padding: 10px;

}

#info div {

display: none;

}

/* class to add to show the content - 'more' */

#info div.more {

display: block;

}

#info h2 {

cursor: pointer; }

Vitamins and Supplements Depot

Curcumin 95 - $20.99

 SHOW AND HIDE INFORMATION USING JAVA I need some help, I

  • Curcumin 95 protects against oxidative damage
  • Delivers 95% curcuminoids
  • 500 mg per capsule
  • 120 veg capsules
  • Not genetically modified
  • Vegan
  • Gluten free

Show More...

Other Ingredients: Cellulose, magnesium stearate (vegetable source) and silicon dioxide. Capsule consists of hydroxypropylmethylcellulose.

Usage: Take 1 capsule per day with food or as directed by your qualified healthcare professional

Note: If you have a medical condition, are pregnant, lactating, trying to conceive, under the age of 18, or taking medications, consult your healthcare professional before using this product.

Copyright© Vitamins and Supplements Depot

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!