Ticket Q535734
Visible to All Users

jQuery on() doesn't work

created 11 years ago

Hello, I'm using PhoneJS to build my first mobile app.
So far everything looks good, I have just to understand the logic of this framework.
I'm now trying to build a list of "posts" (facebook like) where an user can click on them to collapse them.
I'm using this code to perform this task:

JavaScript
$("body").on( "mousedown", ".feeds > li", function() { $(this).addClass("active"); } );

The problem is that this code doesn't work.
If I replace .feeds > li with * and I add an alert to the function:

JavaScript
$("body").on( "mousedown", "*", function() { alert("mousedown"); } );

The event is fired only if I click on the SlideOut menu, if I click on the rest of the page it is not fired.
What am I doing wrong?
Thanks.

Comments (3)
DevExpress Support Team 11 years ago

    Hi Fez,
    Would you please reproduce the issue with the attached project?

      Hi,
      thanks for the reply, I had to wrap the code inside a "document ready" function to make it works properly.
      Thanks for your help.

      DevExpress Support Team 11 years ago

        You are always welcome, Fez.

        Answers approved by DevExpress Support

        created 11 years ago (modified 11 years ago)

        The issue was solved by the customer.

          Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

          Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.