Reputation: 4132
I have set up the following function to change the position of the #help Div on load.
document.getElementById('help').style.left="600px";
How would I make it work on clicking the #help div? (I tried the following)
$('#help').click()document.getElementById('help').style.left="600px";)
Upvotes: 0
Views: 114
Reputation: 1139
$("#help").click(function () {
$(this).css({
left: 600
});
});
Edit: Wrong copy... My bad...
Upvotes: 0
Reputation: 145388
Using plain JavaScript you can set the onclick
event with:
document.getElementById("help").onclick = function() {
this.style.left = "600px";
}
Using JQuery you can set the click event with click()
method:
$("#help").click(function() {
this.style.left = "600px";
});
Upvotes: 6