$ (function () {
var observation = {
Init:function () {
This.render (); //breakpoint: This bind:function () check_length:function () init:function () render:function () Update_checked:functio N () save_observation:function ()
This.bind (); //breakpoint: This bind:function () check_length:function () init:function () render:function () update_checked:funct Ion () Save_observation:function () date_container:r.fn.init[1] radio:r.fn.init[5] REMARKS:R.FN.INIT[1] submit_btn:r.fn.init[1]
},
Render:function () {
Window.now = new Date ();
THIS.SUBMIT_BTN = $ (': Button ');
This.radio = $ ('. Type-radio ');
This.date_container = $ (' #date-picker-date ');
This.remarks = $ (' #remarks ');
},
Bind:function () {
var T = this;//t represents observation object
This.submit_btn.click (function () {
T.save_observation (); //If this is not the case, the observation object cannot be found Save_observation () this represents the current button in the bound event function this represents the bound button
});
This.radio.click (function () {
T.update_checked (this);
});
$ (' #date-picker-date '). Date ({beginyear:now.getFullYear (), Theme: ' DateTime '});//Initialize date selector
This.remarks.bind (' Input ', function () {t.check_length (this);
});
},
Check_length:function (obj) {//Check the length of the memo input},
Update_checked:function (obj) {},
Save_observation:function () {//Save data to server}
};
Observation.init ();
});
JS Object Type (object's properties, methods of object) this keyword