开发者

Conflict between 2 scripts in jquery

I'm trying to use an input validation script in jquery. Which executes on document ready event.

$(function(){
$("#cart").validationEngine(); 
});

Here's the form where I want to use it:

<form id="cart" name="cart_form">
<?php foreach($product as $prods): ?>

        <tr>
        <td><input type="text"  id="qty_sel<?php echo $prods['PID']; ?>" name="qtysell[]" class="validate[required]"/></td>
        <td><input type="text" name="subtotal"  id="subtotal<?php echo $prods['PID']; ?>" class="validate[required]" readonly="readonly"/></td>


    <?php endforeach; ?>
</form>

The above code doesn't work, but when I tried it in something simpler, it actually worked:

<form id="cart" name="a">
<input type="text" id="name" class="validate[required]"/>
</form>

Does this have something to do with another script which I have written which comput开发者_StackOverflowes the subtotal from the given price and quantity. Or is it the ordering of the elements (table, form, input). Which causes the script to not work.


if you have some custom handler on the form's submit action such as

document.getElementById("formID").onsubmit = function(){ 
//custom code here

}

Then the validationEngine will not work ... Try adding your function to validationEngine.js

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜