0

I have a form like this and i need to submit all values in this form except those with class="noDisplay". Pass it to the controller and update the value to "pd-price". Everything works fine, just that i cannot find a way to ignore the noDisplay values to submit the form.

     <div class="cart">
                        <strong>
                            <span class="pd-price">80.407.000đ</span>
                        </strong>

       </div>     


  <form method="post" id="product-details-form" action="xxx">
        <ul>
     <li class="showImg-target noDisplay">
        <input type="radio"  name="product_attribute_46_3_113"> [+3.870.000]
     </li>
     <li class="showImgtarget">
<input type="radio" name="product_attribute_46_4_113">[+1.000.000]</li>

   <li  class="showImgtarget noDisplay">
<input type="radio"  name="product_attribute_46_5_113">[-1.500.000]</li>
    <li  class="showImgtarget noDisplay">
<input type="radio"  name="product_attribute_46_6_113"></li>

                            ..... a lot more 

                                   </ul>
                        </form>


 <script type="text/javascript">
      $(function () {
         updateStatus();
         $('*[name^=product_attribute]').change(function () {
         updateStatus();
         });

       function updateStatus() {
         $.ajax({
                  cache: false,
                  url: '/Catalog/UpdateProductStatus',
                  data: $('#product-details-form').serialize(),
                 type: 'post',
                 success: function (data) {
                 $('.summary-info').html(data.View);
                 $('.pd-price').html(data.Price);
                  $('.powered-icon').replaceWith(data.Pictures);
                        }
                                            });
                                        }
                                    });
                                </script>
2
  • 1
    stackoverflow.com/questions/4556172/… looks like what you need ? Commented Sep 28, 2013 at 17:50
  • thanks, that's look interesting. Commented Sep 28, 2013 at 18:14

1 Answer 1

1

You can use :not() selector:

$('#product-details-form li:not(.noDisplay) :input').serialize();
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.