Switch case with conditions

前端 未结 8 1696
情深已故
情深已故 2020-12-01 02:36

Am I writing the correct switch case?

var cnt = $(\"#div1 p\").length;
                alert(cnt);
                switch (cnt) {
                    case (c         


        
8条回答
  •  猫巷女王i
    2020-12-01 03:23

    Switch case is every help full instead of if else statement :

         switch ($("[id*=btnSave]").val()) {
            case 'Search':
                saveFlight();
                break;
            case 'Update':
                break;
            case 'Delete':
                break;
            default:
                break;
        }
    

提交回复
热议问题