how to change the content | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

how to change the content

i want to change my li tag content but in which nows function does not work and most importantly console does not give me any error plzzz someone correct that issue and thank you in advance. my code is given below. <!DOCTYPE html> <html> <head> <title></title> </head> <body> <h1>this is chaned the background color</h1> <button onclick="change('red')">background is red</button> <button onclick="change('purple')">background is purple</button> <button onclick="chan('green')">green color</button> <button onclick="chan('black')">black color</button> <button onclick="chans()">change text</button> <p id="head">THIS IS A PARAGRAPH</p> <ul id="fruit"> <li>carot</li> <li>potato</li> <li>strawberry</li> <li>banana</li> <li>ananas</li> </ul> <button id="nows()" type="button">now new</button> <script type="text/javascript"> /*var number=prompt('enter the number'); var counter; var fact=1; for(counter=1;counter<=number;counter++){ fact=fact*counter; } console.log(fact); */ function change(color){ document.body.style.backgroundColor=color; } function chan(cahnge){ document.body.style.backgroundColor=cahnge; } function chans(){ var news=prompt("enter your text"); var hm=document.getElementById('head'); var he=head.innerHTML=news; he.document.body.style.textTransform='uppercase'; he.document.body.style.fontSize='40px'; } function nows(){ var spot=document.getElementById('fruit'); var item1=spot.firstChild; var item2=item1.nextSibling; var item3=item2.nextSibling; var item4=item3.nextSibling; var item5=item4.nextSibling; item1.innerHTML= "ahmad"; item2.innerHTML= "shoaib"; item3.innerHTML= "waqas"; item4.innerHTML= "naseer"; item5.innerHTML= "mineer"; } </script> </body> </html>.

4th May 2020, 4:32 PM
Mohammad Waqas
Mohammad Waqas - avatar
21 Answers
+ 1
Send a link of you code it's better i think 🤔
4th May 2020, 4:42 PM
HEUBA BATOMEN Franck Duval
HEUBA BATOMEN Franck Duval - avatar
+ 1
https://code.sololearn.com/WeRpzHj6WJgJ/?ref=app Replaced id from onclick in ur last button
4th May 2020, 4:52 PM
Abhay
Abhay - avatar
4th May 2020, 5:03 PM
HEUBA BATOMEN Franck Duval
HEUBA BATOMEN Franck Duval - avatar
+ 1
The code was too long for a copy
4th May 2020, 5:04 PM
HEUBA BATOMEN Franck Duval
HEUBA BATOMEN Franck Duval - avatar
+ 1
Pardon?
4th May 2020, 5:08 PM
HEUBA BATOMEN Franck Duval
HEUBA BATOMEN Franck Duval - avatar
+ 1
I don't understand that you say
4th May 2020, 5:09 PM
HEUBA BATOMEN Franck Duval
HEUBA BATOMEN Franck Duval - avatar
+ 1
Oh u dont know English
4th May 2020, 5:10 PM
Abhay
Abhay - avatar
+ 1
Ok
4th May 2020, 5:11 PM
HEUBA BATOMEN Franck Duval
HEUBA BATOMEN Franck Duval - avatar
+ 1
Google translate
4th May 2020, 5:11 PM
HEUBA BATOMEN Franck Duval
HEUBA BATOMEN Franck Duval - avatar
+ 1
check the code now
4th May 2020, 5:11 PM
HEUBA BATOMEN Franck Duval
HEUBA BATOMEN Franck Duval - avatar
0
Plzzz can you see my code-bits file name is changing
4th May 2020, 4:49 PM
Mohammad Waqas
Mohammad Waqas - avatar
0
Thanks abhay can you tell me plzzz where i did mistake.
4th May 2020, 4:56 PM
Mohammad Waqas
Mohammad Waqas - avatar
0
<!--how to change the content i want to change my li tag content but in which nows function does not work and most importantly console does not give me any error plzzz someone correct that issue and thank you in advance. my code is given below.--> <!DOCTYPE html> <html> <head> <title></title> </head> <body> <h1>this is chaned the background color</h1> <button onclick="change('red')">background is red</button> <button onclick="change('purple')">background is purple</button> <button onclick="chan('green')">green color</button> <button onclick="chan('black')">black color</button> <button onclick="chans()">change text</button> <p id="head">THIS IS A PARAGRAPH</p> <ul id="fruit"> <li>carot</li> <li>potato</li> <li>strawberry</li> <li>banana</li> <li>ananas</li> </ul> <button id="nows()" type="button">now new</button> <script type="text/javascript"> /*var number=prompt('enter the number'); var coun
4th May 2020, 4:57 PM
HEUBA BATOMEN Franck Duval
HEUBA BATOMEN Franck Duval - avatar
0
Try this code
4th May 2020, 4:57 PM
HEUBA BATOMEN Franck Duval
HEUBA BATOMEN Franck Duval - avatar
0
Bro where is JavaScript code
4th May 2020, 4:59 PM
Mohammad Waqas
Mohammad Waqas - avatar
0
Thanks for help Franck Heuba
4th May 2020, 5:01 PM
Mohammad Waqas
Mohammad Waqas - avatar
0
Franck Bro ur code is not working I dont know what u did but it doest work man
4th May 2020, 5:07 PM
Abhay
Abhay - avatar
0
What r u saying
4th May 2020, 5:08 PM
Abhay
Abhay - avatar
0
Ok bro thanks 👍.
4th May 2020, 5:12 PM
Mohammad Waqas
Mohammad Waqas - avatar
0
who speak French there
5th May 2020, 1:53 PM
vitovelli
vitovelli - avatar