callback - jquery after click -
is there anyway of checking block element remains empty after click event? because need add data if li remains empty after click
$('.order_list li').click(function() { $('#search_block').remove(); if( ! $('#search_block').exists()) { $(this).html(search_box); ... exists custom function found on stackoverflow answer
update
because of $(this).html(search_box); li's content replaced input box, want set text after user clicks on li, without having selected nothing before.
update2
.exists() not problem, problem when user click li , li above remains empty
$.fn.exists = function () { return this.length !== 0; } update3
the problem http://jsfiddle.net/vsj96/1/
i think
$('#search_block').length is easier.
but if want know $('#search_block') has content or not then
$('#search_block').contents().length
Comments
Post a Comment