jQuery custom validation method issue -


i have select list that's default value (for please select) 0. due payment processing system , beyond control. have add.method states if select's value "0" return false, otherwise return true. works ok, except when change select's value else after submitting , getting error, error msg still displayed. how fix this

the html:

<form action="" method="post" id="singlepmnt">     <td>      <select name="technology" class="select" id="singletech">       <option value="0" selected="selected">&nbsp;please select</option>       <option value="interactive brokers">&nbsp;interactive brokers</option>       <option value="mb trading">&nbsp;mb trading</option>       <option value="patsystems">&nbsp;patsystems</option>       <option value="pfg">&nbsp;pfg (peregrine financial)</option>       <option value="td ameritrade">&nbsp;td ameritrade</option>       <option value="trading technologies">&nbsp;trading technologies</option>       <option value="vision financial markets">&nbsp;vision financial markets</option>       <option value="hosted">&nbsp;zen-fire</option>      </select>     </td>     <td>single payment of $995</td>     <td>       <input type="hidden" name="item_number" value="34">       <input type="submit" value="" class="ordernow" />     </td> </form> 

the validation rule using jquery.validate.js

$(document).ready(function() {         $.validator.addmethod(             "selecttechnology",             function(value, element) {                 if ($("#singletech").val() === '0'){                     return false;                 } else return true;             },             "please select technology"         );         var validator = $("#singlepmnt").validate({             rules: {                     technology: {                         selecttechnology: true                     }             },             errorelement: "span",             errorplacement: function(error, element) {                 error.appendto(element.parent("td"));             }         });     }); 

can't see error in this, appreciate help. thanks

try forcing validation in blur event.

$('#singletech').click(function() {   $('#singlepmnt').validate().element('#singletech'); });  $('#singletech').blur(function(){   $('#singlepmnt').validate().element('#singletech'); }); 

jquery change() on <select> , firefox

the live link posted earlier seems work in ie, not firefox.


Comments

Popular posts from this blog

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -