Trying to figure out how I can get jQuery to detect a hyperlink referencing a unique ID on the page. I want to load the event not only when the element is clicked on the page, but also if someone direct links to the page using the unique #id assigned to that #div.
UPDATE:
OK, this is what I have so far and it’s not firing.
function opencontact() {
$("#first-name-check").hide();
$("#last-name-check").hide();
$("#phone-number-check").hide();
$("#email-address-check").hide();
$("#customer-message-check").hide();
$("#send").button("disable");
$("#email-form").dialog("open");
}
$(".email").click(opencontact);
var hash = window.location.hash.substring(1);
alert(hash);
if (hash == "contact") {
opencontact();
}
Alert is returning the correct #hash so I don’t know what’s wrong.
Dialog initialized like this:
$(function() {
$("#email-form").dialog({
autoOpen: false,
resizable: false,
draggable: false,
closeOnEscape: false,
height: 600,
width: 540,
modal: true,
buttons: {
"Send Joe Your Message": {
text: "Send Joe Your Message",
id: "send",
click: function() {
$.post("email.php", $(this).find('input, textarea').serialize());
$(this).find('input, textarea').val("");
$(this).dialog("close");
},
},
Cancel: function() {
$(this).find('input, textarea').val("");
$(this).dialog("close");
}
}
});
});