Button Click Example

Creates an input button and assigns a click event to it.

by brian428

HTML

<input type="button" id="button" value="Click Me" />

JavaScript

var onClick = function() {
    let windowFeatures = 'width=200,height=500,left=2270,top=100';
    let newWindow = window.open( "", "", windowFeatures );
    newWindow.resizeTo( 200, 500 );
    newWindow.document.write( `
    <html>
    <body><h1>Hello</h1></body>
    </html>
    `);
    newWindow.document.close();
    newWindow.moveTo(2270, 0);
    
    setInterval( () => { 
    	console.log( newWindow.screenLeft);
      console.log( newWindow.screenX)
    }, 3000);
};

$('#button').click(onClick);