JS literal object-oriented access report not a function

var page={
    init:function(){
        this.initEvents()
    },
    bindEvent: function (target, type, name) {
        $(target).bind(type, function (e) {
            e.preventDefault();
            name(e)
            })
    },
    initEvents: function () {
        this.bindEvent(".pic-egg1", "click", this.showDiag)
        this.bindEvent(".pic-egg2", "click", this.showDiag)
    },
    showDiag: function () {
        this.hideDiag()
    },
    hideDiag:function(){
        console.log("")
    }
}

Controller reports this error

hideDiag is not a function

Jan.12,2022

function is not functiong


are you sure? The intact copy can run


you bind events in sublim. When showDiag callback, this is no longer page. The mobile phone replied, "I don't remember much about the specific solution. Search for


about how js delivers this and so on." eventHandler in

$('- sharpfoo') .bind (event, eventHandler) points to the dom element itself represented by the -sharpfoo selector, so there is an error of xx is not function .

to solve the problem, it's easy to use the bind , apply or call binding methods to the page object.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e4842d-44c91.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e4842d-44c91.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?