document.getElementById('button').onclick = function() {
alert("button was clicked");
};
document.querySelector("span.testClass#testID").click()
// Create variable for what you are trying to click
let button = document.querySelector("#IDofItem");
// Click the button
if (button) {
button.click();
}
else {
console.log("Error");
}
window.onload = function() {
var userImage = document.getElementById('imageOtherUser');
var hangoutButton = document.getElementById("hangoutButtonId");
userImage.onclick = function() {
hangoutButton.click(); // this will trigger the click event
};
};
<element onclick="functionToExecute()">Click</element>
$('.btn').click(function() {
$('[title=selected]').removeAttr("title");
$(this).attr("title", "selected");
});