javascript - .children(":first-child") - ajax - multiple first children? -
i have simple yet strange problem - when select .children(":first-child")
multiple results given, 1 alert after another.
// ... $.post(ajaxurl, data, function (response) { //alert(response); tinymce.get('geqqo-editor-new').setcontent(''); $('#geqqo-modal-new').modal('hide'); $('#geqqo-modal-new').on('hidden.bs.modal', function (e) { $('#timeline').prepend(response); var new_status = $('#timeline').children(":first-child").attr("id"); alert(new_status); }); // ...
how select first-child (that is, appended one) instead of multiple ones such doing.
try using one method instead of on method , :first
instead of :first-child
$('#geqqo-modal-new').one('hidden.bs.modal', function (e) { $('#timeline').prepend(response); var new_status = $('#timeline').children(":first").attr("id"); alert(new_status); });
Comments
Post a Comment