Can't set on () listener for jqueryui / jqm widget event in $ (document)?

I am trying to set a global binding event on $(document)which is the root of all of my main application functions.

I use some jQueryUI widgets (from jQuery Mobile) and was hoping that I could also include widget events in my global handler.

So, I am trying to do this:

 $(document).on("click change filterablebeforefilter", ".action_elements", function (e) {
   // foo
 });

However, this does not work. I can set the click and change the listeners in my event input, but filterablebeforefiltercannot be set this way. At least I can't get it to work.

JQM demos only specify a direct binding:

 $( ".selector" ).on( "filterablebeforefilter", function( e, data ) {
  // foo
 });

Question:
but I wonder if there is a way to bind an event to document?

Thanks!

+4
1

$() :

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>OnEventHandler</title>
    <script src="Scripts/jquery-2.1.0.min.js"></script>
    <script language="javascript" type="text/javascript">
        $(document).ready(function () {
            $(document).on('click filterEvent', '.action_element', function () {
                alert('You Clicked Me!');
            });
            $('#OrderFilter').change(function () {
                $('#CustomerFilter').trigger('filterEvent');
            });
            $('#CustomerFilter').on('filterEvent', function () {
                alert('CustomerFilter filterEvent');
            });
        });
    </script>
</head>
<body>
    <p>Some text.</p>
    <p class="action_element">Click me!</p>
    <select id="OrderFilter">
        <option>By Order Id</option>
        <option>By Order Total</option>
    </select>
    <p id="CustomerFilter" class="action_element">Just some Text...</p>
</body>
</html>

$(document).on('event', 'selector').

, - , .

JQM , : , , , () {...}?

, , , , ; ( Google ...), , ? , , (, 4 google ?)

, beforefilter (, 3 , google, yahoo, bing). , , ( , ...)

, , , 250 , , , ... , , 250 ... ? , , ?

, , beforefilter , , . , .on() ( ). , .

0

All Articles