Customizing Selectors and Triggers

It's amazing how much you can do with JS Chains. But even more is possible.

Changing selectors

// $('#AgileWeb_learn_understand_unique_id').hide()

// $('.myclass').hide()

// $('#Content').hide()

// $(this).hide()

// $(document).hide()

// $(window).hide()

// $(region).hide()

You can already see the potential of this feature. When binding to an event selector you can reference "this" in the enclosed function - it works great!

The last example refers to "region", which is a global variable pointing to the area which is being loaded via the AJAX request.

Calling functions you can't call

PHP might not let you use some of the function names such as "each" or "for". The "execute" function also has a special meaning to JS chain. If you want to use these functions, then:

// converts into .execute(1)

Using custom trigger

jQuery allows you to define custom events, and then trigger them. Here is a good example.


Bouncy text

Another Bouncy text



$page->add('P')->set('Bouncy text')

$page->add('P')->set('Another Bouncy text')

$page->add('Button')->set('Bounce all')

This approach is good when you can't physically access objects, and yet need to bind actions between them. For example, in CRUD, when you edit an element in the expander, it uses a custom reloading event to refresh the grid.