2013-07-03 85 views
-1

http://jsfiddle.net/PF8nL/1/取消隱藏行使用jQuery切換

使用上述的jsfiddle的代碼我無法隱藏並使用jQuery隱藏行。根據這個stack答案,似乎我正確地做到了這一點。

我有一些愚蠢的錯誤嗎?可能導致這個?

代碼:

$('input[name="custom_rejection_option"]').click(function() { 
    $('.custom_reject_area').toggle(this.checked); 
}}; 
+1

你是最後一個支架'}'應該是一個括號')' –

+2

這個問題似乎是題外話,因爲它是關於一個錯字。 – Barmar

+4

這個問題似乎是脫離主題,因爲它是關於語法錯誤。 – lifetimes

回答

2

You had a syntax error

$('input[name="custom_rejection_option"]').click(function() { 
    $('.custom_reject_area').toggle(this.checked); 

}); 
//You had `}` instead of the closing `)` 
+0

我錯過了...好趕上 – Orangepill

+0

哇,令人尷尬。謝謝您的幫助! – ComputerLocus

+0

它發生。我會看到的第一個地方是瀏覽器的任何明顯的語法錯誤的控制檯。如果這很有用,請將答案標記爲已接受。 – karthikr

2

你只是有一些拼寫錯誤和事情。

$('input[name=custom_rejection_option]').click(function() { 
    $('.custom_reject_area').toggle(this.checked); 
}); 

http://jsfiddle.net/PF8nL/5/