JS Object Type (object's properties, methods of object) this keyword

Source: Internet
Author: User

$ (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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.