JQuery $(window).bind example
by masudcsesust04
HTML
<div class="row-fluid">
<div id="replace-text">Hello wordl!</div>
<button id="replace" class="btn btn-info">Replace</button>
</div>
JavaScript
$(window).bind('load',function(){
event_functions._initialize();
$(document).on('click', 'button#replace', event_functions.replace_text);
});
event_functions = {
_initialize : function(){
// Initialize code here if needs
$('div#replace-text').html('Hello wrld!');
//$('#master_checkbox').removeAttr("checked");
},
replace_text : function(e){
$('div#replace-text').html('Button clicked!');
}
}
<script type="text/javascript">
/** Datatable code **/
var oTable;
var page='all';
var alphabet_list = jQuery(".hidden").html();
$(window).bind('load',function(){
event_functions._initialize();
event_functions._call_dataTable();
$(document).on('click',"#employee-data-table_paginate a", event_functions.unchecked_mastercheckbox);
$(document).on('click', '#master_checkbox', event_functions.toggle_checked);
$(document).on('click', 'a.view_link', event_functions.view_and_edit);
$(document).on('click', '#deleteAll', event_functions.delete_all_checked);
$(document).on('click', '.delete_employee',event_functions.row_delete);
});
event_functions={
_initialize : function(){
$('#master_checkbox').removeAttr("checked");
},
_call_dataTable : function(){
$("#page_select").find("a").click(function(){
page = ($(this).attr('rel'));
$("#all").removeClass("current")
$("#new").removeClass("current")
$("#past").removeClass("current")
$("#"+page).addClass("current")
oTable.fnDestroy();
init_oTable_initialize(page);
});
init_oTable_initialize(page);
init_alphabetical_filters();
init_server_search_fix(); // Will search only hitting enter not...