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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T18:37:50+00:00 2026-06-12T18:37:50+00:00

I have the current html: <input id=dynamic1 /* other */ data-group-animal=y1,y2 /> <input id=dynamic2

  • 0

I have the current html:

<input id="dynamic1" /* other */ data-group-animal="y1,y2" />
<input id="dynamic2" /* other */ data-group-vegetable="y3,y4" />

These are independent divs that can be use together or not when sending data via ajax.

Now, one option i have is to use both fields and i need to retrieve the data-value for both based on some form options. the data attribute is different (is used for different purposes — I can send or not all the groups or separately)

so I want to do:

$('input').data('group*') but it does not work, then I realize I need a regexp.

is there a regexp for data attribute i can use?

  • 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-12T18:37:51+00:00Added an answer on June 12, 2026 at 6:37 pm

    You could use selectors if you change your attributes.

    http://jsfiddle.net/kvJVM/1/

    So, you could have instead a data-group-type and query for that:

    <input id="dynamic1" data-group-type="animal" data-group="y1,y2" />
    <input id="dynamic2" data-group-type="vegetable" data-group="y3,y4" />​
    

    Some example queries

    $('input[data-group]') // all
    
    $('input[data-group-type^="animal"]') // starts with 'animal'
    $('input[data-group-type*="l"]') // contains 'l'
    $('input[data-group-type!="animal"]') // not 'animal'
    

    There are other selectors: http://api.jquery.com/category/selectors/​​​​​​​​​

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

Sidebar

Related Questions

I have the following HTML: Current HTML <div id=testContainer> <a href=testPage.htm target=_top> <img src=/res/images/testImage_M.jpg?lc=en-GB&lv=5.jpg
The JavaScript code window.print() can print the current HTML page. If I have a
i have this html menu: <ul id='main'> <li class='active current' id='lighty'> <a href='/'>Lighty</a> <ul>
Okay so say I have a form element like this: HTML: <div class=form-item> <label>Current
I have have a simple HTML form with say four input widgets (see below)...two
I have an HTML form with three inputs for phone number input. I want
I have this div which contents depends of the current time of HTML embedded
I have 2 sets of 4 input fields in my HTML Form. I expect
I have an HTML form that a user can add an arbitrary amount of
I have a simple search script that takes user input and searches across directories

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.