How can i add jquery to Appcelerator Titanium Mobile Work?

后端 未结 4 1299
轮回少年
轮回少年 2021-02-06 18:13

Is it possible to integrate the jquery in to Titanium Appcelerator and will it work properly? Else we can\'t integrate the jquery in titanium appcelerator?

any one help

4条回答
  •  野性不改
    2021-02-06 18:54

    First You should create a htlm file. You should see code details below. There is jquery function. Do not forget upload jquery-1.9.min.js

    
    
    
    
    
    Local URL
    
    
    
    
    
    
    
        

    A Local Webpage

    Touch to Fire Event
    Listening...

    And Another update code blocks on app.js

    var win = Titanium.UI.createWindow({
        title:"App to Web View Interaction Through Events",
        backgroundColor:"#FFFFFF"
    });
    
    var webView = Titanium.UI.createWebView({
        url:"html/index.html"
    });
    
    var button = Titanium.UI.createButton({
        title:"Fire WebView Javascript",
        height:48,
        width:220,
        bottom:12
    });
    
    button.addEventListener("click",function(e){
        webView.evalJS("firedFromWebView('Fired!')");
    });
    
    //We can use a custom event listener to fire native code from Javascript pages
    //by using Titanium.App.addEventListener
    Titanium.App.addEventListener("fromWeb",function(e){
        //The data structure and value of e is defined in the
        //index.html page
        alert(e.value);
    });
    
    win.add(webView);
    win.add(button);
    win.open();
    

提交回复
热议问题