简体   繁体   中英

Change Cell Background When Clicked

I'm setting up a system that tracks submissions from my employees in Google Sheets. Each day I check to see if they have submitted the proper paperwork. What I am wanting to accomplish is, when I click (or select) a cell with that employee's name, I want to change the background color when I click (or select) that cell.

Nothing I've tried has worked.

var color = [ 
   ["#06c646"] 
  ];

var cell = SpreadsheetApp.getActiveSpreadsheet().getActiveCell();
cell.setBackground(color);

Nothing seems to be doing what I want it to do.

You could try it with jQuery:

$(selector).on("click", function() { // add cell's class/id here
    $(this).css({'background-color':'blue'});
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM