I would really appreciate if somebody could help me. I am trying to dynamically build a collapsible block with jQuery mobile 1.2 Beta (using jQuery 1.7.1).
Now I have the problem that I want to have an button inside a collapsible header and all works fine but when I click on the button the click event I set on it is not fired but instead the block gets uncollapsed or collapsed.
$('#main').append('<div data-role="collapsible" data-theme="c" data-content-theme="c" id="pflicht_'
+ identifier + '" pflichtID="' + val.guid + '">' +
'<h3 style="white-space: normal;" id="inner_header_' + identifier + '">'
+ header + ': ' + val.pflichtBezeichnung + ' (' + val.Intervall + ' - ' + val.IntModus + ') '
+ val.pflichtNummer + '.' + val.pflichtZusatz +
'<button type="button" data-inline="true" id="ok" pflichtID="'
+ val.guid + '" identifier="' + identifier + '" >Ok</button></h3>' +
'</div>'
$("#ok").live('click', function () {
alert("ok");
});
What do I have to do to get the click event of the button?
Thanks for your help!