Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 828841
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T03:47:20+00:00 2026-05-15T03:47:20+00:00

chrome.tabs.executeScript(null, {code:$.each(selectValues, function(key=’ + timestamp + ‘, value=’Custom’) { $(‘#expire’). append($(\<option></option>\). attr(\value\,key). text(value)); });});

  • 0
chrome.tabs.executeScript(null, {code:"$.each(selectValues, function(key='" + timestamp + "', value='Custom')
{   
     $('#expire').
          append($(\"<option></option>\").
          attr(\"value\",key).
          text(value)); 
});"});

It says that the first line has a syntax error, and the WebKit inspector shows odd highlighting patterns.

What’s wrong with that? A friend thinks I need to escape some characters somewhere.

Thanks for the help!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T03:47:21+00:00Added an answer on May 15, 2026 at 3:47 am

    That’s definitely not valid syntax. You have an equal sign in the formal parameter list.

    It will presumably end up as:

    $.each(selectValues, function(key='someTime', value='Custom')
    {   
         $('#expire').
              append($(\"<option></option>\").
              attr(\"value\",key).
              text(value)); 
    });
    

    I recommend you use the file option if possible, so you don’t have to deal with escaping issues:

    chrome.tabs.executeScript(null, {file: "myScript.js"});
    

    The presumably the code in myScript.js will be something like:

    $.each(selectValues, function(key, value)
    {   
         $('#expire').
              append($("<option></option>").
              attr("value",key).
              text(value)); 
    });
    

    However, it’s not clear what you’re trying to do. jQuery.each takes a callback with two parameters, but what do you expect to happen to the values on the right of the equal sign?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Consider this code: function SwapColumns() { chrome.tabs.executeScript(null, {code:SwapNameAndSurname();}); } The code above is in
This is code: chrome.tabs.getSelected(null, function (abcd) { alert(abcd.index)); }); I wonder know how this
I insert myscript.js in current page in chrome tab with chrome.tabs.executeScript(null, { file:myscript.js}, function()
Here's the script: function runScripts() { if (arguments.length === 0) return; chrome.tabs.executeScript(null, { file:
Now, I'm writing function tabStatusOnChange(tabId, changeInfo) { if(changeInfo.status == complete) chrome.tabs.executeScript(null, {file:oneuniverse.js}); } chrome.tabs.onUpdated.addListener(tabStatusOnChange);
chrome.tabs.create({ 'url': 'https://www.myserver.com/', 'selected': false }, function(tab) { chrome.tabs.executeScript(tab.id, { 'code': doSomething(); }); });
I have the following code in my background script: chrome.tabs.onUpdated.addListener(function(tabId, changeinfo, tab) { if
I have this code which send an image to test.php: chrome.browserAction.onClicked.addListener(function(tab) { chrome.tabs.captureVisibleTab(null, function(img)
I've got the following in my background.html to sendRequest to contentscript... chrome.tabs.getSelected(null,function(tab) { chrome.tabs.sendRequest(tab.id,{req:func});
In my background (background.html) page I have the following js: function capturePage(){ chrome.tabs.captureVisibleTab(null, function(img){

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.