rakela
rakela

Reputation: 303

Jquery - check all events

I need to check these elements for all jquery events:

 $('#taskAdd, #unit_qtyAdd, #work_unitAdd').live('{all events}', function(){
   //some code here
   }

here is the full js:

$(document).ready(function(){
$('#taskAdd, #unit_qtyAdd, #work_unitAdd').live('{all events}', function(){
term1 = $('#taskAdd').val();
term2 = $('#unit_qtyAdd').val();
term3 = $('#work_unitAdd').val();
term4=$("#job_task_idAdd").val();
$.ajax({
        type: "POST", 
        url: "",    //the url
        data: "s1="+term1+"&s2="+term2+"&s3="+term3+"&s4="+term4,
        success: function(data) {
        $( "#estimatedAdd" ).val('').val( data );
        $( "#chargedAdd" ).val('').val( data );
        }
    });
    });
});

Anybody can help, please?

Upvotes: 0

Views: 101

Answers (1)

Andrea Turri
Andrea Turri

Reputation: 6500

As I told you in the comment:

.live() is deprecated now, so use .on().

For a validation I suggest you to use jquery.validate

This is the basic usage:

$(form).on('click', 'yourSubmitButton', function() {

    $(form).validate();

});

If you mean data binding, to see what happen in real time in your fields, try to take a look at Knockoutjs.

Upvotes: 1

Related Questions