cakephp Js 助手

发布于 2025-01-05 00:29:53 字数 513 浏览 2 评论 0原文

我想做这样的事情。

如果我点击某个 DIV (id='#some-link'),它应该会显示另一个 DIV (id='#busy-indicator')

我已经写了以下内容,但它不起作用。

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

应该进行哪些修正才能使其正常工作?

它生成以下输出。

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

I want to do something like this.

If I click on some DIV (id='#some-link'), it should show me the another DIV (id='#busy-indicator').

I have written following, but it's not working.

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

What should be the correction to get it working?

It generates following output.

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

凉城 2025-01-12 00:29:53

您可以使用如下所示的“两步”解决方案:

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

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

这是 HTML 输出:

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

You can use a "two-step" solution like this:

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

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

This is the HTML output:

$(document).ready( function(){
  $("#some-link").bind("click", function(event) {
    $("#busy-indicator").fadeIn();
    return false;
  });
});
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文