In JQuery, how to pass the element that was clicked to the method that is called on onclick event

后端 未结 5 508
情深已故
情深已故 2020-12-14 17:46

I have several of these lines on a page:

Save

In my Save() met

5条回答
  •  醉话见心
    2020-12-14 18:03

    Pretty straight forward...

    $('#myDiv').click(function(){
       save($(this));
    })
    
    
    function save($obj){
       $obj.css('border', '1px solid red');
    }
    

提交回复
热议问题