-2

I have used some code to fill my inputs bij an onclick function. Now the first line works but it seems that he skips the other lines what can I do?.

This is my code:

var InputProduct = document.getElementById("product");
var InputNaam = document.getElementById("Anaam");
var InputPrijs = document.getElementById("APrijs");
var InputVolgorde = document.getElementById("AvolgNR");


function fill($name, $prijs , $volgorde)
{
    InputProduct.value = $name;
     InputNaam.value = $name;
      InputPrijs.value = $prijs;
       InputVolgorde.value = $volgorde; 
}

and this is how i use the onclick:

onclick="fill('<?php echo $adviesprijzen['Naam']; ?>', '<?php echo $adviesprijzen['BedragInclBTW']; ?>', '<?php echo $adviesprijzen['volgorde']; ?>')"
Cœur
  • 37,241
  • 25
  • 195
  • 267
  • What element types are the 3 failing items? Are there errors in the console? – Alex K. May 30 '17 at 12:33
  • [ID's Must Be Unique](http://stackoverflow.com/questions/5611963/can-multiple-different-html-elements-have-the-same-id-if-theyre-different-eleme), specifically because it will cause problems in [JavaScript](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id) and CSS when you try to interact with those elements. – Jay Blanchard May 30 '17 at 12:33
  • what is the error? – Dinesh undefined May 30 '17 at 12:33
  • you must be getting `undefined` for `document.getElementById("Anaam")`. Hence code execution is not proceeding further beyond the line `InputNaam.value = $name;` . Please make sure that you provided correct `id` in each statement. – vijayP May 30 '17 at 12:34
  • code worked when i created a `test.php` with the above code like this:-https://eval.in/807697 (check code not output) (at my local end) so it seems that `document.getElementById("Anaam")` and so on others are undefined – Alive to die - Anant May 30 '17 at 12:44
  • thanks fot the replies, my consol did not give an error so thats why i put up this question. howevers after uploading it again it apeared to be working so the problem seems to be solved. – Jordi van Dijk May 30 '17 at 14:23

1 Answers1

0

It seems to be working again after re-uploading the files.