I have this anchor tag
<a class="productin" onclick="openbox()" data-pid="23">Report</a>
This opens up an modal box which sends an email, I have a hidden input tag inside that email form in which i want to add that data-pid
<input type="hidden" name="productid" id="productid">
Since you tagged this question with jQuery, I'll give you the jQuery answer. This should work:
$(function(){
$('a.productin').click(function(){
$('input:hidden[name="productid"]').val($(this).data('pid'));
});
});
FYI - It is normal procedure in Stack Overflow to post the code you have tried on your own. We are here to help you fix issues with your code, not to write your code for you. In the future do a search for an answer before you ask the question and give it a shot on your own. Then, you can ask why your code didn't work posting the relevant code for us to see. That's is why your question was voted down.
It is also normal procedure for the downvoter to explain why he voted it down.
Firebase Cloud Functions: PubSub, "res.on is not a function"
TypeError: Cannot read properties of undefined (reading 'createMessageComponentCollector')
I'm working on an AngularJS app and I'm stuck. [nnn]I have a simple tabbled interface section with the same layout for every tab section.
I’ve got some simple rolling progress bars, fed by a percentage number on the page (later this will come from a database), which change color and width dependent upon this number. Got them working nicely in one context, but on another page they need to use different...
I've looked through the existing questions and i don't believe they are answering my question. [nnn]I have created a table that gets populated using PHP and MySQL.
I have some divs in my HTML and I want to copy the contents of a div when I click on that div. .