In the following JSFiddle, I am trying to get the header value from this line
header += '<tr height="30"><td width="33%" align="left"><u><b>' + data[i].catDesc + '</b></u><br></td>
in the following section of the code:
Basically, I want to pass the header information in the title
of the jQuery UI dialog as shown below (commented part)
$('.hideClass').bind('click',function(){
alert("button clicked");
/*$('#wrapper').dialog({
autoOpen: false,
title: 'dynamic title goes here',
maxHeight: 500,
width: 1000,
height: 400,
modal: true,
buttons: {
"Print": function() {
$(this).dialog("close");
},
Download: function() {
$(this).dialog("close");
}}
});
$('#wrapper').dialog('open');*/
});
I tried doing this by adding a div
tag and assigning an id
as shown below:
header += '<tr height="30"><td width="33%" align="left"><div headerId = "' + data[i].catDesc + '"><u><b>' + data[i].catDesc + '</b></u></div><br></td></tr><tr height="5px"></tr>';
And tried to retrieve it like this in the code :
var title = ($(this).attr('headerId'));
console.log("title test");
console.log(title);
But I keep getting undefined
. Here is the modified JSFiddle with above unsuccessful attempt