call functions in another function

Here is the five functions. But I want to call first four functions in the last function.

$(document).ready(function(){   
    $('#check_network_button').click(function(){
        if( $("#network_octet1_text").val()==octet[1] && $("#network_octet2_text").val()==octet[5] && $("#network_octet3_text").val()==octet[6] && $("#network_octet4_text").val()==octet[7] ){

        } else {
            $("#network_ok_text").val("NO");
        }
    });
    $('#check_firsthost_button').click(function(){
        if( $("#firsthost_octet1_text").val()==octet[1] && $("#firsthost_octet2_text").val()==octet[8] && $("#firsthost_octet3_text").val()==octet[9] && $("#firsthost_octet4_text").val()==octet[10] ){

        } else {
            $("#firsthost_ok_text").val("NO");
        }
    });
    $('#check_lasthost_button').click(function(){
        if( $("#lasthost_octet1_text").val()==octet[1] && $("#lasthost_octet2_text").val()==octet[11] && $("#lasthost_octet3_text").val()==octet[12] && $("#lasthost_octet4_text").val()==octet[13] ){

        } else {
            $("#lasthost_ok_text").val("NO");
        }
    });
    $('#check_broadcast_button').click(function(){
        if( $("#broadcast_octet1_text").val()==octet[1] && $("#broadcast_octet2_text").val()==octet[14] && $("#broadcast_octet3_text").val()==octet[15] && $("#broadcast_octet4_text").val()==octet[16] ){

        } else {
            $("#broadcast_ok_text").val("NO");
        }
    });
    $('#checkall_button').click(function(){

    });
});

I want to call all the above functions in the last function.

Answers 1

  • Try:

    $('#checkall_button').click(function () {
        $('[id$="_button"]').not(this).trigger('click');
    });
    

Related Articles