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
$('input[value='+ myID + ']')?myID?console.log(myID);and re-confirm it.