Getting attribute val inside a UI callback
I want the get the attribute value of my "event_id" attribute defined in my div inside the open portion of the dialog jquery function but I don't know how to get that information. The reason I need it is b/c ultimately I'm calling another JS function inside the open: of the dialog that requires this value. Thanks in advance.
I have the following:
HTML:
<div id="dialog" title="Dialog Title">
TEST
</div>
<p><a href="#" id="dialog_link" event_id="111181">Open Dialog</a></p>
script:
jQuery(document).ready(function($) {
// Dialog
$('#dialog').dialog({
modal: true,
autoOpen: false,
width: 600,
height: 400,
open: function(event,ui) {
var id = $(this).attr("event_id");
alert(this.event_id); // <-- value "undefined"
},
buttons: {
"Ok": function() {
$(this).dialog("close");
},
"Cancel": function() {
$(this).dialog("close");
}
}
});
// Dialog Links
$('#dialog_link').click(function(){
$('#dialog').dialog('open');
return false;
});
}