I am new to html dom that's why i don't know too much about it. I want to execute two functions in single html dom event. Here is the code.
<a id="link1" href="javascript:void(0)" onclick="document.getElementById('link1').style.background-color='red';
setTimeout(function () {window.location.assign='http://www.google.com'}, 5000);"> Read it</a>
Here i want to execute two functions. One is background color and second is opening google after 5 seconds, How can i get it in html dom. Please help me thanks.
onclickattributes, you should be writing pure Javascript in a .js file, attaching event handlers programmatically. Then the answer would be more obvious too.window.location.assignis a function. You need to call it.window.location.assign('http://www.google.com');. If you want to use=, you just dowindow.location='http://www.google.com';. developer.mozilla.org/en-US/docs/Web/API/Window.location