0

How to add to html program like if we press a button something will come but we have to use 2 div id like <div="a">h</div> and

<div id="b"> ..if we press h word of div 2 will display are you understanding i want to make a button which when pressed show the value of div id="b" like i want to use get inner html byit with the div id so it can display another word onclick the button so i can make a super program using button display. Please help me !!!

26th Sep 2020, 7:15 AM
《G __O__D》
《G __O__D》 - avatar
3 Antworten
+ 3
Explanation: 1) Add onclick attribute to the tag mentioning the function to be performed when clicked 2)Then using js set it properties by defining the same function there
26th Sep 2020, 12:39 PM
Vijay Gunwant
Vijay Gunwant - avatar
+ 2
https://code.sololearn.com/WsGXOrnXXDNB/?ref=app In this code check The "Lets play" button it may give you your desired solution. On clicking it the div is changed if you need more explanation then please do tell me
26th Sep 2020, 12:28 PM
Vijay Gunwant
Vijay Gunwant - avatar
+ 2
For clear code check this https://code.sololearn.com/WM2n85mumHbP/?ref=app (Check onclick attribute and js)
26th Sep 2020, 12:37 PM
Vijay Gunwant
Vijay Gunwant - avatar