Maximus1809
Maximus1809

Reputation: 585

JQuery Mobile - ListView onClick Handling

I'am a beginner at JavaScript and now i want to handle a click on a listview item.

But i cant get any reaction with my code. I cant handle the "onClick-Event". :(

Here is my script:

  <body>
    <section id="listView">
                        <ul id="listViewTest" data-role="listview" data-inset="true" data-divider-theme="a" data-filter-theme="a">
                            <!-- Wird dynamisch befüllt -->
                        </ul>
    </section>

     <script>
        $('#listview li').live('click', function() {
            alert("Works");
        });
    </script>


  </body>

Upvotes: 0

Views: 195

Answers (1)

Nicole Stein
Nicole Stein

Reputation: 925

Live() has been deprecated. This looks like the answer to your problem: jQuery .live() vs .on() method for adding a click event after loading dynamic html

Upvotes: 1

Related Questions