I need to validate some dynamically generated form data to ensure clients
can't order more of something than we have in stock. I can't set static
comparisons. Here is my html:

<form action="addtocart.php" method="post">
<input type="submit" class="addtocart" value="add selected items to cart" />    
            
                
<div class="instock">
  <h4>manual 1</h4>
  <div class="qty" title="90">90</div>
  <input name="150" type="text" id="150" class="order-qty" /><label
for="150">Qty:</label>
</div>

<div class="instock">
  <h4>manual 2</h4>
  <div class="qty" title="48">48</div>
  <input name="151" type="text" id="151" class="order-qty" /><label
for="151">Qty:</label>
</div>
                
</form>
                
I want to validate on keyup(). In rough pseudocode, something like this:

$(document).keyup(function(event){
  if (($this.getValue(input)) > ($this.getValue(span.qty))) {
    addText("Not enough in stock");
  }
});                

I know that's not even close. Could someone help me?
-- 
View this message in context: 
http://www.nabble.com/validating-dynamically-generated-data-tp17091060s27240p17091060.html
Sent from the jQuery General Discussion mailing list archive at Nabble.com.

Reply via email to