javascript - Execute click on button when mouse if out of button area -


i button page can clicked when mouse on it.

the button looks :

<button class="btn-large red" data-bind="text: submitlabel, trueclick: submit,           css: { 'light-skin': ff.dealticket.uselightskin, disabled: !isvalid() || isorderpending() ||issubmitting(), blue: isbuy(), red: !isbuy(), yellow: isoco() }">place sell trade</button> 

i want execute click on button, in console of developer tool (google chrome browser) write code :

document.queryselector('button.btn-large.red').click; 

when entered code return "undefined" , nothing happens. when put in interval like:

setinterval(function(){     document.queryselector('button.btn-large.red').click();     }, 2000) 

it should click on button every 2 seconds not click. when put mouse on button, code interval works , clicked...

i tried interval focus on

setinterval(function(){     document.queryselector('button.btn-large.red').focus();     document.queryselector('button.btn-large.red').click();     }, 2000) 

...but same, not click when mouse away button.

what should click on button mouse away button ?

your code seems working. why it's not working? did add event listener click event on button?

document.queryselector('button.btn-large.red').addeventlistener('click', function() {    console.log('clicked');})    document.queryselector('button.btn-large.red').click();      setinterval(function() {    document.queryselector('button.btn-large.red').focus();    document.queryselector('button.btn-large.red').click();  }, 2000)
<button class="btn-large red" data-bind="text: submitlabel, trueclick: submit,            css: { 'light-skin': ff.dealticket.uselightskin, disabled: !isvalid() || isorderpending() ||issubmitting(), blue: isbuy(), red: !isbuy(), yellow: isoco() }">place sell trade</button>

check jsfiddle.


Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -