+ 6

A value to The Button

how do i make value to the button

20th May 2018, 11:21 AM
Alieldien
Alieldien - avatar
11 Réponses
22nd May 2018, 7:10 PM
🐯🐯Gimba Abdul Aziz🐯🐯
🐯🐯Gimba Abdul Aziz🐯🐯 - avatar
+ 11
<button onclick= "document.write("welcome") > </button>
20th May 2018, 11:33 AM
᠌᠌Code X
᠌᠌Code X - avatar
+ 7
<button onClick="test()">Example</button> <h1 id="wel"></h1> <script> function test(){ var write= wel.innerHTML="WELCOME"; } </script>
20th May 2018, 11:33 AM
Sudarshan Rai
Sudarshan Rai - avatar
+ 6
👇 <input type="button" value="example">
20th May 2018, 11:23 AM
Sudarshan Rai
Sudarshan Rai - avatar
+ 5
no i mean when i click on a button it writes welcome
20th May 2018, 11:27 AM
Alieldien
Alieldien - avatar
+ 5
You can achieve that by using one of this two methods: 1. Displaying the message in an HTML element <button onclick="welcomeMessage()">Click Me</button> <div id="messagePanel"></div> <script> function welcomeMessage(){ var messagePanel = document.getElementById("messagePanel"); // displaying the message with textContent is preferable to innerHTML, because of the latter's security vulnerability messagePanel.textContent = "Welcome!"; } </script> 2. Use an alert to display the message. <button onclick="welcomeAlert()">Click Me</button> <script> function welcomeAlert(){ alert(" Welcome!") } </script>
20th May 2018, 12:44 PM
Adedokun Yinka Enoch
Adedokun Yinka Enoch - avatar
+ 2
thanks
20th May 2018, 12:56 PM
Alieldien
Alieldien - avatar
+ 2
thanks for all for answer👍👍👍👍😉🌀
20th May 2018, 4:46 PM
Shahzod Shark
Shahzod Shark - avatar
+ 1
<button onclick = “welcome();”>Click Me!</button> <script> function welcome() { alert(“Welcome!”); } </script>
21st May 2018, 8:07 AM
Rowsej
Rowsej - avatar
0
use this <input type="button" value="example">
21st May 2018, 12:39 AM
Parth
Parth - avatar
0
thank you it helps me
22nd May 2018, 9:25 PM
Alieldien
Alieldien - avatar