הסתדרתי מצורף דוגמא:
$("#theButton").on("click", function () {
chrome.tabs.query({ active: true, currentWindow: true }, function (tabs) {
chrome.tabs.sendMessage(
tabs[0].id,
{ greeting: "hello", color: $("#input_1").val() },
function (response) {
}
);
});
});
chrome.runtime.onMessage.addListener(function (request, sender, sendResponse) {
if (request.greeting === "hello") {
document.body.style.backgroundColor = request.color;
sendResponse({ farewell: "goodbye" });
}
});