+ 1

Could you help mi on javaScript

My cod is -> <li id="li">Serhat Merak<button>Cut</button></li> <script> alert(document.getElementById("li").innerHTML) </script> it gives -> Serhat Merak<button>Cut</button> but I want to get-> Serhat Merak how can I get it help me please😊😊😊

5th Jun 2017, 1:03 PM
Serhat Merak
Serhat Merak - avatar
5 Answers
+ 12
alert(document.getElementById("li").textContent.replace("Cut", ""));
5th Jun 2017, 1:13 PM
Maz
Maz - avatar
+ 2
Thank you maz 😊
5th Jun 2017, 1:55 PM
Serhat Merak
Serhat Merak - avatar
+ 1
Use innerTEXT instead of innerHTML
5th Jun 2017, 1:36 PM
Siddharth Saraf
0
innerText gives Serhat MerakCut
5th Jun 2017, 1:55 PM
Serhat Merak
Serhat Merak - avatar
0
Maz could you look my new question please 😊😊😊
5th Jun 2017, 2:40 PM
Serhat Merak
Serhat Merak - avatar