jquery - Accessing functions from an external .js file -


this external .js file html.

html: li id="getphoto"

what's best way access function. can't work.

$(document).ready(function() {    $('#getphoto').click(function() {       function getphoto(source) {          // retrieve image file location specified source             navigator.camera.getpicture(onphotourisuccess, onfail, { quality: 50,              destinationtype: destinationtype.file_uri,             sourcetype: source });        }    }); }); 

you don't have happening here. when click #getphoto, you're declaring getphoto() function, not calling it. how call function.

$('#getphoto').click(function() {    getphoto(somevar); });  function getphoto(source) {     // retrieve image file location specified source     navigator.camera.getpicture(onphotourisuccess, onfail, {         quality: 50,         destinationtype: destinationtype.file_uri,        sourcetype: source      }); } 

that should set on right path.. looks might in on head.


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -