Quantcast
Channel: Appcelerator Developer Center Q&A Tag Feed (evaljs)
Viewing all articles
Browse latest Browse all 83

evalJS not working with passing variables

$
0
0

I am using evalJS to attempt to call a function in a webview and pass a parameter to that function. It will work perfectly if I pass a string but if I try to pass a variable nothing happens.

var calendarView = Ti.UI.createWebView();
    calendarView.url = '../views/calendar_list_view.html';
this will work fine
calendarView.evalJS(scrollDate('03/03/2011'));
but if I try to pass a variable it does nothing
var date = "03/03/2011";
calendarView.evalJS(scrollDate(date));
then the webview has a JS function
function scrollDate(date) {
        document.getElementById(date).scrollIntoView();
    }

Viewing all articles
Browse latest Browse all 83

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>