javascript简单封装

var $ =  function(id){
        return  {
                elment : document.getElementById(id),
                on : function(event,callback){
                    this.elment['on' + event] = callback;
                }
            }
    };

    $('click').on('click',function(){
         $('demo').elment.innerHTML = $('test').elment.value;
    });

你可能感兴趣的:(javascript简单封装)