0

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>

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.