I am making the products page for one of my sites, and firefox keeps giving me the error it can't find the ID I am requesting. Every other browser works fine except for firefox.

<form mehtod="post">
     <input type="text" onclick="SelectAll(this.id)' onkeypress="return isNumber(event)" maxlength=2 style="width:3em; text-align:center;" id="quantity_ <?php echo $fetch['id']; ?>" value="1">
<a onclick="Add(<?php echo $fetch['id']; ?>,quantity_<?php echo $fetch['id']; ?>.value);" href="#">Add</a>

</form>

Im lost to why this will not work I have tried everything.

Recommended Answers

All 3 Replies

Don't know whether that works for you. What does the '.value' in the onclick mean?

<form method="post">
     <input type="text" onclick="SelectAll(this.id)" onkeypress="return isNumber(event)" maxlength=2 style="width:3em; text-align:center;" id="quantity_ <?php echo $fetch['id']; ?>" value="1">
<a onclick="Add(<?php echo $fetch['id']; ?>,quantity_<?php echo $fetch['id']; ?>);" href="#">Add</a>

</form>

Ok, think you want to get the value of the input box.Can use javascript.Don't know this is correct any please try with this.

<form method="post">
     <input type="text" onclick="SelectAll(this.id)" onkeypress="return isNumber(event)" maxlength="2" style="width:3em; text-align:center;" id="quantity_<?php echo $fetch['id']; ?>" value="1">

<a onclick="Add(<?php echo $fetch['id'];?>);" href="#">Add</a>

</form>

<script>
 function add(id)
{
  var value = document.getElementById("quantity_"+id).value;
}
</script>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.