+ 1
JavaScript
Can someone helps me,to make that every bottons of this Laptop 💻 works and to see what i write on the Screen? Thanks 😊 https://code.sololearn.com/WAJ8y0WZIoRB/?ref=app
6 Réponses
+ 2
better solution is to replace your js functions with this
doesnt require adding onclick to html, will need to add if else to handle special keys
$(function() {
$("button").click(function() {
let message = $("#laptop").html() //value of currently displayed text
key = $(this).html(); //value of key clicked +<br/>
console.log(key); // used for debuggng
key = key.slice(0,1); // removes trailing <br/> tag
message = message + key;
$("#laptop").html(message)
});
});
+ 1
add an onClick function call to each button, use jquery to edit html where to want
+ 1
ok thank you so much Jason,i will try it later when i get at home,then i will let you if it works so😊👍🏽
+ 1
thanks it works 👌🏽😁💻
0
can you please write an example?