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 8854883
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T13:59:14+00:00 2026-06-14T13:59:14+00:00

Possible Duplicate: How to select html nodes by ID with jquery when the id

  • 0

Possible Duplicate:
How to select html nodes by ID with jquery when the id contains a dot?

I have an jquery modal, the function is to show profile box.

<a rel="Modal" href="#<?php echo $username; ?>">Profile</a>

So far is ok if username isn’t using ID dot (.)

<div id=<?php echo $username; ?>

The problem is coming when username using ID dot (.), example john.doe. The box can’t show anything.

So how can I set that ?

Thanks for kind 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-06-14T13:59:16+00:00Added an answer on June 14, 2026 at 1:59 pm

    The quick and dirty solution would be to transform the problem characters to something less problematic. For example

    <?php $normalisedUsername = htmlspecialchars(
        str_replace('.', '_', $username), ENT_QUOTES); ?>
    
    <a rel="Modal" href="#<?php echo $normalisedUsername; ?>">Profile</a>
    
    <!-- snip -->
    
    <div id="<?php echo $normalisedUsername ?>"> ...
    

    I say this is dirty because the . is perfectly valid inside an ID attribute. The better solution would be to alter the jQuery code used to find the modal contents. The scope to do this depends entirely on whether or not your modal utility is one you have written yourself or part of a library like jQueryUI or Bootstrap.

    For example, if you were using Bootstrap’s Modal, you could add the appropriate escapes to the trigger’s data-target attribute, eg

    <button type="button" data-toggle="modal" data-target="#john\\.doe">Launch modal</button>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: How to select html nodes by ID with jquery when the id
Possible Duplicate: Select values of checkbox group with jQuery In HTML I have a
Possible Duplicate: xpath select elements between two nodes based on this html i need
Possible Duplicate: how to style the option of a html select? I have an
Possible Duplicate: How to implement “select all” check box in HTML? Select all and
Possible Duplicate: Html select option lost data after submit I have a select menu
Possible Duplicate: Select xml node by attribute in php Is there any function like
Possible Duplicate: jquery: select the last 4 items in the list jQuery has the
Possible Duplicate: select all checkboxes command jquery, javascript I am having trouble selecting all
Possible Duplicate: Update a Select Box on Parent Page from FancyBox2 I'm trying to

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.