move your body How to make this range a link without adding inline javascript...">All geek questions in one placeJQuery click on spacebar and drive<span class="link">move your body</span> How to make this range a link without adding inline javascript and additional attributes?Also without conversion to <a>.Like this:$(".link").click(function(){ // go to the http://site.com }) Thank.+3jquery html hyperlinkJames Sep 09 '10 at 15:55source share4 answersYou mean this:$("span.link").click(function(){ $(this).css('cursor', 'pointer'); window.location = 'www.example.com'; }) +9Sarfraz Sep 09 '10 at 15:58source share$(".link").click(function(){ window.location = "http://example.com"; }) It would also be nice to add.link { cursor: pointer; } +3Ben Sep 09 '10 at 15:59source share$(".link").click(function(){ window.location = "http://yoururl.com" }) +1Stefanvds Sep 09 '10 at 15:58source share$(".link").click(function(){ $(location).attr('href', $(this).text()); }) 0Mark baijens Sep 09 '10 at 15:58source shareSource: https://habr.com/ru/post/1764025/More articles:How can I convert this Apache Rewrite rule to a Tuckey UrlRewriteFilter rule? - javadeleting an array of a pointer to a structure - c ++Is there a way to get a test for disabled control? - silverlightSplit an array of objects by common parameters in Ruby - arraysWhy are socket async callback methods usually static? - c ++Request record to kill user session - sqlWith Appscale, does this mean that I can deploy GAE applications on Xen VPS hosts without worrying about server maintenance? - google-app-engineСделать TextView оранжевым при фокусировке? - androidHow can I resolve the error "could not find the vapply function" in R? - rPreferred Android developer phone to use ZXing library - androidAll Articles
<span class="link">move your body</span>
How to make this range a link without adding inline javascript and additional attributes?
Also without conversion to <a>.
<a>
Like this:
$(".link").click(function(){ // go to the http://site.com })
Thank.
You mean this:
$("span.link").click(function(){ $(this).css('cursor', 'pointer'); window.location = 'www.example.com'; })
$(".link").click(function(){ window.location = "http://example.com"; })
It would also be nice to add
.link { cursor: pointer; }
$(".link").click(function(){ window.location = "http://yoururl.com" })
$(".link").click(function(){ $(location).attr('href', $(this).text()); })
Source: https://habr.com/ru/post/1764025/More articles:How can I convert this Apache Rewrite rule to a Tuckey UrlRewriteFilter rule? - javadeleting an array of a pointer to a structure - c ++Is there a way to get a test for disabled control? - silverlightSplit an array of objects by common parameters in Ruby - arraysWhy are socket async callback methods usually static? - c ++Request record to kill user session - sqlWith Appscale, does this mean that I can deploy GAE applications on Xen VPS hosts without worrying about server maintenance? - google-app-engineСделать TextView оранжевым при фокусировке? - androidHow can I resolve the error "could not find the vapply function" in R? - rPreferred Android developer phone to use ZXing library - androidAll Articles