xxxxxxxxxx
//this is an event detector for a mouseclick with Jquery
$('#id').on('click',function(){
yourFunction(args);
});
xxxxxxxxxx
document.querySelector('html').onclick = function() {
alert('Ouch! Stop poking me!');
}
xxxxxxxxxx
// An event is triggered when a user clicks on the #button element,
// which then sets the #button element's background-color to blue.
$('#button').on('click', event => {
$(event.currentTarget).css('background-color', 'blue');
});
xxxxxxxxxx
Events are things browser or user do it like click,scroll,press keyboard.
const button =document.querySelector('#submit)
const title = document.querySelector('.title')
//Click,Scroll,Resizing the browser
button.addEventListener('click', function(){
console.log('New Item added');
//when button with id #submit click it console.log
mainTitle.classList.toggle("spectacular");
})
//css
.title{
font-size:16px;
color:"black";
transition: all 0.5s ease;
}
.spectacular{
font-size:"20px",
color:red;
}