Skip to main content

Posts

Showing posts from July, 2009

New Function disableToggle to toggle disable on and off

New Function disableToggle to toggle disable on and off similar to slideToggle /********************* Function:disableToggle author:Mukesh License: Void of any license **********************/ $.fn.disableToggle = function() { if(($(this).attr("disabled")=="disabled") ($(this).attr("disabled")==true)) { $(this).removeAttr("disabled"); } else { $(this).attr("disabled","disabled"); } }; This function can be called as $("#element-id").disableToggle(); where element_id is the id of the element. For e.g., $("#edit-name").disableToggle();

Callback function to run after any specific ajax request that is predefined

Whenever any homework needs to be done after any ajax request has been loaded then this approach can be utilized. For e.g. whenever any title of table derived from liberation_make_table is clicked for sorting the columns then an ajax request is made. So if the table is loaded in div with id "maketable-1" Then suppose some steps are to carried out after ajax request is loaded onto that table. An alert needs to be displayed when the ajax request is completed Then this section can be added: $("#maketable-1").ajaxComplete(function(event,request, settings){ alert("hello"); });