kushal33

jquery prevent default and table sibling selector

May 17th, 2016
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. $('.btn-submit').click(function (e) {
  2. e.preventDefault();
  3. var flag = false;
  4. $('.materialAccHead').each(function () {
  5. if (($(this).find('option:selected').val() == '' || $(this).find('option:selected').val() == 'undefined')) {
  6. $(this).addClass('errorclass');
  7. scrollToTopError('errorclass');
  8. flag = true;
  9. }
  10. });
  11. $('.advance_amount_class').each(function () {
  12. var order_amount = parseFloat($(this).parents('tbody').find('.order_amount').html());
  13. if($(this).val()!='') {
  14. if(order_amount < parseFloat($(this).val())) {
  15. $(this).addClass('errorclass');
  16. scrollToTopError('errorclass');
  17. flag = true;
  18. }
  19. }
  20. });
  21.  
  22. if (flag == false)
  23. {
  24. $('#yii-purchase-add-form').submit();
  25. }
  26. });
Add Comment
Please, Sign In to add comment