0

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.

2
Contributors
3
Replies
4
Views
6 Years
Discussion Span
Last Post by @developer
0

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>
0

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>
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.