简体   繁体   English

单击时更改单元格背景

[英]Change Cell Background When Clicked

I'm setting up a system that tracks submissions from my employees in Google Sheets. 我正在建立一个系统来跟踪我的员工在Google表格中提交的内容。 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: 你可以尝试使用jQuery:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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