or
$.Deferred(function(){ var promise = this; timer = setInterval(function() { if ($("#my-drawer:not(:visible)")[0]) { clearInterval(timer); promise.resolve(); } }, 100);})<?php if ($customers) { ?><?php foreach ($customers as $customer) { ?><li> <h3 class="time"><?php echo $customer['date_added']; ?></h3> <h3><?php echo $customer['name']; ?></h3> <a data-role="button" data-rel="external" style="float: right;" href="mailto:<?php echo $customer['email']; ?>" data-icon="compose">Email</a> <p><small><?php echo $column_email; ?>: <?php echo $customer['email']; ?></small></p> <p><span><b><?php echo $customer['status']; ?></b></span></p></li><?php } ?><?php } else { ?><li> <h2><?php echo $text_no_results; ?></h2></li><?php } ?><script type="text/javascript"> function showAlertWindow(message) { var alertWindow = $('#alertWindow').data('kendoWindow'); alertWindow.content(message); alertWindow.refresh(); alertWindow.center(); alertWindow.open(); } function server_error_handler(event) { if (event.errors) { event.sender.one("dataBinding",function(e){ e.preventDefault(); }); //event.preventDefault(); //event.sender.cancelChanges(); var message = "Errors:\n"; $.each(event.errors, function (key, value) { if ('errors' in value) { $.each(value.errors, function () { message += "</br><strong>" + key + "</strong>: " + this + " \n"; }); } }); message += " </br> </br> <strong>No updates were saved!</strong>"; showAlertWindow(message); } }</script>//event.preventDefault();//event.sender.cancelChanges();$(document).on("change", "input.Percentage", function () { var grid = $("#grid-pct").data("kendoGrid"); var row = $(this).closest('tr'); var dataItem = grid.dataItem(row); var rawVal = $(this).val(); if (rawVal >= 0 && rawVal <= 100) { var data = { Id: dataItem.id, Percentage: rawVal, Username: dataItem.Username, UpdateDate: dataItem.UpdateDate }; } else { $(this).kendoTooltip({ autoHide: false, content: 'value can only be between 0 and 100' }); $(this).css('border-color', '#f00'); }});