Recherche de la valeur d'attribut à partir d'un hachage d'URL.jQuery find attribut from url hash
// URL
http://url.com/index.html#link
// HTML
<a href="#link" rel="3">Some link</a>
// JS
var anchor = window.location.hash.substring(1);
// Need help finding attribute value from finding the anchor
var attribute = .find('#+anchor').attr('rel'); //this needs to have a value of 3
Toute aide appréciée. Merci :)
grand. maintenant, comment puis-je obtenir l'inverse ... trouver un #hash d'un rel? – Jeffrey
@Jeffrey - Le même type de sélecteur, par exemple: '$ ('a [rel =" quelque chose "]'). Attr (" href ")' –
merci, ça l'a fait – Jeffrey