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

  • Home
  • SEARCH
  • 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 8849759
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T12:44:13+00:00 2026-06-14T12:44:13+00:00

sorry for my english I have this code : jsfiddle no problem How I

  • 0

sorry for my english

I have this code :

jsfiddle

no problem

How I can adapt the code when “select” is like this :

<select id="example[164]" name="example[164]" type="text" />
<option value="0">0</option>    
<option value="1">1</option>    
<option value="2">2</option>    
<option value="3">3</option>    
</select>
<div class="test">    
Some text...<br /><input type="checkbox" name="foobar" value="1" /><br />More text...       
</div>`

jsfiddle

Thanks for your help

:D)

  • 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-06-14T12:44:14+00:00Added an answer on June 14, 2026 at 12:44 pm

    This HTML is not valid except in HTML5. The characters [] are not permitted in the id attribute, which should be letters, numbers, periods, hyphens, underscores, and colons.

    To match that invalid id with jQuery, you would need to escape the [] with two backslashes:

    // Match all select elements beginning with example in the id
    $('#example\\[164\\]')
    

    In context of your example, change $('#example') to $('#example\\[164\\]')

    $('#example\\[164\\]').focus(function() {
        if (timer)
            clearTimeout(timer);
        $('div.test').css('display','block');
        // etc...
    

    Later, it also appears as:
    function(e) {

        if ($(e.target).closest('.example, #example\\[164\\]').length) return;
    

    However, since this is not a valid id attribute (unless you are using HTML5), you should instead match on the element’s name attribute, and if this is being generated on the server side, instead change the id attribute to something valid like <select id='example_164'>.

    // [] are valid in a name
    $('select[name="example[164]"').focus(function() {
        if (timer)
            clearTimeout(timer);
        $('div.test').css('display','block');
    

    Here is the updated jsfiddle

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

Sidebar

Related Questions

sorry about input mistakes, english its not my mother lang. I have this code
Sorry for my bad English. Just like what I asked. I have this class
Hy! Sorry for my bad english, anyway the questions is: I have this code
First, sorry for my bad english, I'm French. Here the problem : I have
I have this problem with my code, the page is redirecting and wouldn't stop..
i have a problem with this code: public partial class KnihovnyForm : Form {
I have code like this on some aspx page in my Web Application: <asp:Content
I have this code: <script type=text/javascript> $(document).ready(function(){ var id = 'i1'; var image =
Hi everyone i have this fully working code on jsfiddle: http://jsfiddle.net/Scanu/DhpXN/ But it's not
Sorry for my English. This problem is complicated, and my English isn't thats good

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.