data attribute from anchor not sending value ti hidden input [closed] - javascript

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 years ago.
Improve this question
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.

Related

Value change of input with no id [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 4 days ago.
Improve this question
enter image description here
enter image description here
I can't edit the html as I am using another system. I'm trying to change the value of an input field without an id with the value of a drop-down by clicking button. I'm really stumped on the no id part.
See images to see if you have any suggestions.
Thank you as I am new to Java.
I tried document.queryselector, but don't know how to use it.
I can only use basic Java.

JavaScript, what is "binde" means, not "bind"? document.binde.tagname...? [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 2 years ago.
Improve this question
I have in my JS code, some lines with binde, what is it? Why is it working and what does it mean?
On example with, type="checkbox":
if (document.binde.nameofthecheckbox.checked)
{
//...its true whens checked and do the code
}
or
somevar = document.binde.somehtmltagname.value;
somevar gets the value of "somehtmltagname"
No one can answer me, I only heard "never seen something like that before". I would be happy to know what it is, and not only using it because it works.
It is not well known, but document might define HTML elements with id specified as document[HTMLElement.ID] as such, if there is an <input id="binde"> on the page, it will point to that.
If not, try logging it:
console.log(document.binde)

If statement not working properly in form validation [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 5 years ago.
Improve this question
I've would like to make a really simple form validation is JS.
I've created a function with if statements inside,while everything is ok it should display nothing and when something is not right (number in a name input for e.g)
a message under a certain input should be displayed.Right now it sometimes work,sometimes not.
If anybody could look at my code and tell me what's wrong would be really helpful
Here's my live version
Here's the code
You are using name="name-surname" twice (in two different input tags), which prevents the values to be sent properly. Use the same values for name as the values for the IDs

Don't understand how Google's infinite load example works [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 8 years ago.
Improve this question
Would anyone be willing to explain how the following example works?
http://scrollsample.appspot.com/items
I don't understand how the URL gets updated (changes from /items?page=2 to /items?page=3)
I also do not understand how the rel tags get updated either (prev/next/canonical)
Thanks for any help you can provide.
Check out http://scrollsample.appspot.com/static/main.js
and look for the initPaginator function. There's a call to history.replaceState.
history.replaceState allows you to update the address bar without a page change.

Onclick copy to clipboard [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 8 years ago.
Improve this question
Hey guys actually i'm trying to give my website users a possibility to click on a button and have some predefined text, in my case contact informations, to the clipboard.
These informations are already given in a div tag with the id="footer" and i want to fetch those or predefine them manually in syntax.
At the end of the page is a scissor, this is a after:element, this element ill change to a link or anything other so i can make it work.
Here's a link to the site
You can try this jquery plugin:
https://github.com/zeroclipboard/zeroclipboard
This makes it possible to copy text to youre clipboard with a button.

Categories