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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T23:45:16+00:00 2026-06-16T23:45:16+00:00

This one is a bit different than the solutions I’ve found thus far. What

  • 0

This one is a bit different than the solutions I’ve found thus far. What I have is an HTML form with nearly 500 tags (a browser-based timecard input accounting for a 15-hour window all 7 days with inputs for 15-minute intervals). I’ve named these input tags to be fairly intuitive. Monday’s inputs are named M600, M615, M630, M645, M700 … M2100. Tuesday’s are T###, W### and so on. All of them are in a single form, when on submittal JSON-encodes everything and writes it to a text database to be recalled dynamically later. If the form has not been submitted (via a hidden tag to detect submittal, the page will pull in and decode values from the JSON file into the form as default input values.

What I’m wanting to do is somehow create an html link for each day that will clear only that day’s set of values. I have an idea that this would somehow trigger from a link (or button) onClick event, and run a script that would be similar to form.field.this.value(“”). However, rather than referencing ‘this’, I need to reference all inputs with the equivalent of a regex search string of, say, $(M\d)^.

In an algorithmic sense:

<input type="text" value="1234" name="M900"/>
<input type="text" value="3456" name="M915"/>
<input type="text" value="1234" name="T900"/>
<input type="text" value="3456" name="T915"/>
<a onClick="clearMondayOnly">Clear Monday's Fields</a>

<script>
function clearMondayOnly() {

  for each input element where name matches "M###" do
   $0.value=""
  end
}
</script>

Admittedly I’m not fluent in javascript, though I’m sure I could muddle my way through, if I knew how to initiate match strings. Additionally, I’d like to try avoiding things like jQuery objects, as I’m sure this can be done with just straight-up JS.

Thanks.

  • 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-16T23:45:17+00:00Added an answer on June 16, 2026 at 11:45 pm

    Something like this should work in plain modern JavaScript:

    function clearDays() {
    
      var days = [].slice.call( arguments ),
          inputs = document.querySelectorAll(
            'input[name^='+ days.join('], input[name^=') +']'
          );
    
      [].forEach.call( inputs, function( input ) {
        input.value = '';
      });
    
    }
    

    You can call it like:

    clearDays('M');
    clearDays('M','T');
    clearDays('M','W','Su');
    // etc...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Bit of a backstory to this one... I have an ASP.NET Login App on
Let's say I don't have more than one or two dozen objects with different
Ok, been scratching my head on this one for a bit now... seems related
This one is a huge issue: first off, while I know a little bit
I'm a bit lost on this one. How can I get an OutOfBounds? Is
So this one is probably very simple, but I'm having a bit of trouble
Having a bit of trouble wrapping my head around this one. I'm sure the
I'm a bit of a n00b with jquery so this one is probably an
I've been trying to figure this one out for a bit using patterns or
This one's got me stumped and it's driving me nuts. I have a SiteFinity

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.