2016-07-16 5 views
-2

jQueryダイアログボックスを作成しようとしています。「OK」ボタンをクリックすると、データをクリックするたびにデータが送信されます。jQuery、ダイアログボックスを1回だけクリックすることができます。yesボタン

私はそれを何度もクリックするか、「OK」ボタンを1回クリックするだけで1回だけ動作する必要があります。あなたは "$ .dialogue" プラグインを手に入れた

$.dialogue({ 
        class: 'big', 
        body: html, 
        yes: { 
         text: 'ok', 
         func: function() { 

          //execute some codes 

        }, //end function 
        }, 
        no: {text: 'Cancel'}, 
       }); 
+0

? –

+0

あなたは 'var checker = true;を持っています。 (checker){// code hereここに checker = false;} ' – guradio

+0

プラグインによっては、クリックされたボタンまたはダイアログそのものとして' this'が渡されます。それがボタンの場合、 'func:function(){$(this).hide();'(または「ボタン」の作成方法に応じて無効にする)ことができます。 –

答えて

1
$.dialogue({ 
        class: 'big', 
        body: html, 
        yes: { 
         text: 'ok', 
         func: (function() { 
          var executed = false; 
          return function() { 
          if (!executed) { 
          executed = true; 
          //execute some codes                
         } 
         }; 
        })(), //end function 
        }, 
        no: {text: 'Cancel'}, 
       }); 
関連する問題