如何在单击时选择li标签值并显示在phonegap的文本框中 [英] How to select the li tag value on clicking it and display in a text box in phonegap

查看:64
本文介绍了如何在单击时选择li标签值并显示在phonegap的文本框中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

$(document).ready(function(){
    $(document).bind('deviceready', function(){
        //Phonegap ready
        onDeviceReady();
    });
var output1 = $('#ullist');
                  
                  $.ajax({
                         url: 'http://samcroft.co.uk/demos/updated-load-data-into-phonegap/landmarks.php',
                         dataType: 'jsonp',
                         jsonp: 'jsoncallback',
                         timeout: 5000,
                         success: function(data, status){
                         $.each(data, function(i,item){

                                var landmark = <ul><li önclick="Javacsript:select(this)">'+item.name+'</li></ul>';
                                
                                function select(x)
                                {
                                    //document.write(item.name);
                                    // alert("Row index is: " + x.rowIndex);
                                    alert("This is testing");
                                
                                } 
                                output1.append(landmark);
                                
                                });
                         },
                         error: function(){
                         output.text('There was an error loading the data.');
                         }
                         });
                  });





这是我的脚本文件我可以在li中显示网址内容标签,我试着点击它。但它没有用。那么如何选择li标签值并在html页面的文本框中显示。



this is my script file i am able to show the url content in the li tag and i tried onClick on it. but it didn't work.So how to select the li tag value and display in a text box in the html page.

推荐答案

document )。ready( function (){
(document).ready(function(){


document )。bind(' deviceready' function (){
// Phonegap ready
onDeviceReady();
});
var output1 =
(document).bind('deviceready', function(){ //Phonegap ready onDeviceReady(); }); var output1 =


' #ullist');


这篇关于如何在单击时选择li标签值并显示在phonegap的文本框中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆