how to change the content | SoloLearn: Learn to code for FREE!

+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>.

5/4/2020 4:32:07 PM

Mohammad Waqas

21 Answers

New Answer

+1

Send a link of you code it's better i think 🤔

+1

https://code.sololearn.com/WeRpzHj6WJgJ/?ref=app Replaced id from onclick in ur last button

+1

https://code.sololearn.com/WXChw75FT2Qy/?ref=app

+1

The code was too long for a copy

+1

+1

I don't understand that you say

+1

Oh u dont know English

+1

+1

Google translate

+1

check the code now

0

Plzzz can you see my code-bits file name is changing

0

Thanks abhay can you tell me plzzz where i did mistake.

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

0

Try this code

0

Bro where is JavaScript code

0

Thanks for help Franck Heuba

0

Franck Bro ur code is not working I dont know what u did but it doest work man

0

What r u saying

0

Ok bro thanks 👍.

0

who speak French there