How to run a function on button click?

Arthur S.

How do I run this function If I click on the button?

<button id="button">Button</button>

var tween = new TWEEN.Tween(mesh.scale).to({ x: 1, y: 0.05, z:2 }, 1000).start();


tween.easing(TWEEN.Easing.Elastic.InOut);
tween.repeat(Infinity);
tween.yoyo(true);
fanfavorite

Using jQuery:

$('#button').click(function(){
   var tween = new TWEEN.Tween(mesh.scale).to({ x: 1, y: 0.05, z:2 }, 1000).start();
   tween.easing(TWEEN.Easing.Elastic.InOut);
   tween.repeat(Infinity);
   tween.yoyo(true);
   return false; //if you want the button to not process anything further
});

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How to intercept button click, run analytics code, and then continue with click function

run a nested function on button click

Run php function on button click

How to run Jquery function on modal popup button click

How to run a function that a on form submit ajax with automatic click button

How to run a function declared in jsp from a button click

How do i run a node specific function on button click

How can calculate automatically without click any button to run function

HTML on-click button to run javascript function

Javascript button click on event to run a function

Run a defined function on page load and on button click

How to call function on button click?

How to run code on server on the click of button?

How to run python scripts on button click in React?

How to run application of the first with click on the button in android?

How to run code on a button click in android fragment

How to run methods in onCreate() without button click

How can I run a function when a radio is selected and I click a button?

How to run js function after popover content loads - after button click?

How to get a function to run again on 2nd and 3rd (and so on) click of a html button?

How do I click my button or run my function automatically in react native?

How to run form action and click event simultaneously on button click

vuejs run function after click back button in browser

jQuery run same function on click button or onchange dropdown

Run JS function after form validates on button click

click a button multiple times to run the same function, java android studio

Function doesn't run when I click on the button

JQuery function - run on click and on page load for specific radio button

javascript run function only once per button click