- Check existence of an attribute :
if ($('#id').attr('attributo') !== undefined) {
NOTE: id attribute is never undefined, but equal to ""
// attribute exists
} - Check existence of an element :
if ($('#id').length > 0) {
// element exists
} - Show/Hide image ajax loading :
html :
javascript:
$(document).ready(function(){
$('#loadingimg').ajaxStart(function() {
$(this).show();
}).ajaxStop(function() {
$(this).hide();
});
}
Commenti
Posta un commento