Dynamic listview
Dynamic listview
hi,
i have the following code:
- <script type="text/javascript">
-
-
- $(function() {
- $("#text-ricerca").keyup(function(event) {
- if (event.keyCode == 13) {
- $.ajax({
- url : 'ricerca.clienti.php',
- type : "POST",
- data : "id=" + $('#text-ricerca').val(),
- success : function(response) {
-
- $('#ListaClienti').empty();
- $("#ListaClienti").html("<li><a href='#' id='SelezionaCliente'>blabla</a></li>");
- $("#ListaClienti").listview("refresh");
- }
- });
- }
- });
- $("#SelezionaCliente").click(function() {
- alert('button clicked');
- });
- });
- </script>
- </head><!-- /head -->
- <body>
- <div data-role="page" >
- <div data-role="header" data-position="fixed">
- <a href="#" data-icon="forward" class="ui-btn-right" rel="external">Logout</a>
- <h1>Clienti</h1>
- </div><!-- /header -->
- <div data-role="content" id="content">
- <!--<p>Hello world!</p>-->
- <div class="ui-grid-a">
- <input name="text-ricerca" id="text-ricerca" value="" placeholder="Cerca clienti..." type="search">
- <div class="ui-block-a" id="ui-block-a">
- <ul data-role="listview" data-inset="true" data-split-icon="arrow-r" data-split-theme="d" id="ListaClienti">
- <!-- <li><a href='#' id='SelezionaCliente'>blabla</a></li>-->
- </ul>
- </div><!-- /ui-block-a -->
- <div class="ui-block-b" id="ui-block-b">
- </div><!-- /ui-block-b -->
- </div><!-- /grid-a -->
- </div><!-- /content -->
- <div data-role="footer" data-position="fixed" style="overflow:hidden;">
- </div><!-- /footer -->
- </div><!-- /page -->
When i press key return the code generate a listview. it works fine but when i click to item 'blabla' the function 'SelezionaCliente' is not called. Instead if i write the code Html at line 38 the function is called and it work!
where am I doing wrong?
thanks in advance
johnix