Monday, November 2, 2009

[jQuery] i can't use HTML ID's appended dynamically

Hi Guys i'm having a serious problem :
i'm using a JSON File to bring data and append it into HTML element so
i can get few divs and a link <a> i automatically generate the <a>
ID's then i select each ID and call a jdialog plugin so i can display
a dialog window
the problem is that the jdialog is not working based on generated ID's
but it works when ever i name it statically
i tried to change the position of the script puting in down the page
but still got nothing and yes i got this problem so many times i feel
like i'm having a missing part out the jquery puzzle any information
would be so helpful and appreciated thank you this is a part of the
code

<script type="text/javascript">
$(document).ready(function() {

$.getJSON('b.json', function(data) {
$('#cont-reservation').empty();


$.each(data, function(entryIndex, entry) {


var date= entry['date'];

if(date == $('#datepicker1').text()){
var html = '<div class="entry reservation" id="' + entry['id'] +
'">';

html += '<a href="javascript:return false;" ><div class="reserve-
ico' + entry['etat'] + '"></div></a>';
html += '<div class="time time ">' + entry['time'] + '</div>';
html += '</div>';
html += '</div>';

$('#cont-reservation').append(html);

}
});
return true;
});
});


function jsonDate(){
$.getJSON('b.json', function(data) {
$('#cont-reservation').empty();


$.each(data, function(entryIndex, entry) {

var date= entry['date'];

if(date == $('#datepicker1').text()){
var html = '<div class="entry reservation" id="' + entry['id'] +
'">';
html += '<a href="javascript:return false;" ><div
class="reserve-ico' + entry['etat'] + '"></div></a>';
html += '<div class="time time ">' + entry['time'] + '</div>';
html += '</div>';
html += '</div>';
$('#cont-reservation').append(html);
}
});
return true;
});
}
</script>

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate