Hey camper, I have a simple problem… this is my code:
$(function () {
$("#button").click(function(){
$("#message").myFunction(); // how to call a function here ? when the user click the button ? it should be retrunet in a element with #message selector
});
So the question is simple - how to call myFunction in brackets { } ? In translate, I need this:
When the user click to the button “NEW QUOTE”, so it should call this function:
function myFunction () {
number = Math.floor(Math.random() * (max - min + 1)) + min;
if (number === 1) {
return "Pokial nejsi prvy, tak si posledny";
}
else if (number === 2) {
return "Nechce se ti do toho? Udelej to!";
}
else {
return "Dej psovi jídlo a bude na tebe čumět celej život";
}
}
and return some random quote to the element with #message selector
How? Your help can save 60 minutes + for me, so thank you very much.