Reputation: 26822
For the title of my website, I have the following code with a DIV onclick so that the user can click anywhere on the title and refresh the page:
<div class="title" onClick="document.location.href='xxxx';">
However the W3C validator tells me this:
there is no attribute "onClick"
I've read about doing this in jQuery, but I've not had much luck getting that work. Can anyone help me here?
Thanks
Upvotes: 0
Views: 2529
Reputation: 23303
$(".title").click(function(){
document.location.href='xxxx';
}):
Upvotes: 4
Reputation: 5519
Some of the options.
<div class="title" onclick="javascript:reloadPage();">
function reloadPage()
{
window.location.reload();
}
or
<div class="title" onclick="window.location.href=window.location.href">
or
$(".title").click(function(){
document.location.reload();
}):
Upvotes: 0