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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T23:38:13+00:00 2026-06-18T23:38:13+00:00

I have html like this <div class=container> <input type=hidden class=myID value=123123123 /> <div class=firstName></div>

  • 0

I have html like this

<div class="container">
   <input type="hidden" class="myID" value="123123123" />
   <div class="firstName"></div>
   <div class="lastName"></div>
   <div class="myImage"></div>
</div>

it is repeated over and over

I want to change the value of div with class “.firstName” that follows a specifc hidden field. I have this value properly stored in a var like this

var myID = @Model.myID;  //this is from c# mvc, but nevermind that - its value is correct
$('input[value="'+ myID + '"]').next(".firstName").text("mynewvalue");

How do I select a hidden input based on it’s value with a variable in the selector?? I know that the hidden field is not even being selected , so the code after that – the .next() isnt important , I just need to know how to properly select a hidden field based on its value

I tried

$('input[value="myID"]').
$('input[value="'+ myID + '"]')
$('.myID[value="'+ myID + '"]')
$('[value="'+ myID + '"]')

UPDATE

oh, if I try $('input[value="123123123"]') meaning manually just type a value in there – it works

  • 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-18T23:38:14+00:00Added an answer on June 18, 2026 at 11:38 pm

    You can select hidden fields and you can select them by matching their attributes and values.

    jQuery:

     $(":input[type='hidden'][value='123']");
    

    This fiddle should get you sorted, of course you’ll have to adapt it to your code. Docs on multiple attribute selectors : http://api.jquery.com/multiple-attribute-selector/

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

Sidebar

Related Questions

I have some HTML that looks like this: <div> <div class=value> <a href=# class=clicker>Some
I have a HTML structure as follows: <div class=container> <label>Name:</label> <div class=controls> <input type=text
i have my html something like this... <div class = content> <div class =
I have some HTML like this: <div id=MyDiv> <div class=Class1> <div class=SClass1></div> </div> <div
i have a html text like this: <div id=content> <p>para1</p> <p>para2</p> <p>para3</p> <p class=break>para4</p>
I have html that looks like this with several items <div class=item> <p class=price>$388.00</p>
I have some HTML that looks like this: <div class=product> Content In Here <div
I have html like: <fieldset> <div> <ul> <li class=test> This paragraph contains a very
I have some html like this: <div class=vmail vmail-bar normal-vmail-bar id=pm_<?php echo $pm->to_id; ?>>
Sample HTML/CSS: <div class=container> <input type=text /> <div class=filler></div> </div> div.container { padding: 5px;

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.