2013-02-14 57 views
0

我想顯示在後確認jquery.thanks按鈕OK單擊窗體questionery形式questionery ...如何顯示後確認的jQuery按鈕OK點擊

$("input[value='Close']").click(function() { 
       var ValidComment = document.getElementById('comment_update').value; 
       if (ValidComment == '') { 
        $("#ErrorUpdate").text("Comment is Required");     
        return false; 
       } 
       else { 
        return confirm('Are you sure to close this ticket ?'); 
        --show form here-??    
       } 
      }); 
+0

你回來,你不能在功能中做任何事情後,由於C ontrol已被返回,並且該函數中的其他內容都不會執行。 – 2013-02-14 15:01:41

+0

看看http://api.jquery.com/html/ .hope這會有所幫助。 – Ramin 2013-02-14 15:02:22

+0

@raminomrani爲什麼在這裏會有所幫助? – Blazemonger 2013-02-14 15:04:56

回答

2

我認爲這應該工作,但我可以」 T檢驗是:

 $("input[value='Close']").click(function() { 

      if ($("#comment_update").val() == '') { 
       $("#ErrorUpdate").text("Comment is Required");     
       return false; 
      } 
      else { 
       if (confirm('Are you sure you want to close this ticket?')) { 
       //Show form code goes here 
       $("#form").show();    
      } 
     }); 
+0

將整個函數包裝在'$(function(){});' – 2013-02-14 15:04:43

0

這工作太

$("input[value='Close']").click(function() { 
    var ValidComment = document.getElementById('comment_update').value; 
    if (ValidComment == '') { 
     $("#ErrorUpdate").text("Comment is Required");     
     return false; 
    } 
    else { 
     var result = confirm('Are you sure to close this ticket ?'); 
     if (result) { 
      $("form-here").css("display", "block"); 
      return true; 
     } 
     return false; 
    } 
});