i have html code like:
<button type="button" class="button button-raised larger" onclick="app.shareOnIg();">Share on Instagram</button>
</div>
<script type="text/javascript">
app.initialize();
</script>
js looks like:
var app = {
// Application Constructor
initialize: function() {
this.bindEvents();
},
bindEvents: function() {
document.addEventListener('deviceready', this.onDeviceReady, false);
},
shareOnIg: function () {
Instagram.share('picture', 'example', function (err) {
});
}
};
I want to replace example with actual value dynamically. plz advise how. I tried to add a parameter in the function and modified the call like
<button type="button" class="button button-raised larger" onclick="app.shareOnIg(" + myparam + ");">Share on Instagram</button>
</div>
but this did not work
addEventListenerto bind event from JavaScript. To pass parameter from onclick, you need to wrap the string in quotesonclick="myFun('" + param + '");myparamis global ? If variable is global you can use it like that:onclick="app.shareOnIg(myparam);"