I encounter a problem with jQuery and anchors which href concerns a microsoft desktop windows application.
I am working on an internal app which provides links such as :
<a id="launch-21" class="launch-app" href="c:\windows\explorer.exe" target="_blank">
I would like to target all the link containing windows for instance in order to bind the following actions :
jQuery('a[href*="windows"]').click(function(event){
alert("use this link in your windows workstation");
event.preventDefault();
});
This has no absolutly no effect.
But when I run the following selector, elements are well returned.
It seems the treatment doesn’t work with hard drive links ?
jQuery(‘a[href*=”windows”]’)
Does anybody an help me ?
Your code seems to work without any problem,
Maybe you’re running it before
$(document).readyis triggered, or the links in question are loaded in the DOM and ready to be parsed using javascript.Try changing your javascript to:
(I’ve created a fiddle for this, you may test it there)
(please note that i took the liberty of changing your alert to a prompt in order to do some testing)
In alternative you can also move your javascript to the end of the page, before closing your
<body>tag.