2012-02-11 14 views
0

私はこのようなことをしたい。cakephp Jsヘルパー

をクリックすると、別のDIV (id='#busy-indicator')が表示されます。

私は以下のように書いていますが、動作していません。

$this->Js->get('#some-link')->event('click', $this->Js->get('#busy-indicator')->effect('fadeIn')); 

有効にするにはどうすればよいですか?

以下の出力を生成します。これは、HTML出力である

$event = $this->Js->get('#busy-indicator')->effect('fadeIn'); 

$this->Js->get('#some-link')->event('click', $event); 

$(document).ready(function() { 
    $("#busy-indicator").bind("click", function (event) { 
     $("#busy-indicator").fadeIn(); 
     return false; 
    }); 
}); 
+0

あなたはjQueryを含めていますか?それは自動的にCakePHPに含まれていません。また、ビュー/レイアウトの下部に '$ this-> Js-> writeBuffer();'を使ってJavaScriptキャッシュを書いていることを確認してください。 –

+0

はい、jQueryと$ this-> Js-> writeBuffer()をインクルードしました。すでにレイアウトの底にあります。 – gautamlakum

答えて

1

あなたは、このような "二段階" のソリューションを使用することができます

$(document).ready(function(){ 
    $("#some-link").bind("click", function(event) { 
    $("#busy-indicator").fadeIn(); 
    return false; 
    }); 
}); 
関連する問題