im struggling to get a function to be delayed for 3 seconds.. this is on an image -
function base64_tofield() {
$('#formfield').val($.scriptcam.getFrameAsBase64());
document.form.submit();
};
ive tried:
setTimeout( function () {
base64_tofield();
}, 3000);
to no avail. the form is just submitting without the 3 second delay - any ideas? do i need to 'block' the form or what?
thanks!
image code:
<img id="btn1" onclick="base64_tofield()">
Live Demo : alert will popup after 3 secs.
Try this:
<img id="btn1" onclick="new_fun()">
function new_fun()
{
setTimeout( function () {
base64_tofield();
}, 3000);
}
function base64_tofield() {
$('#formfield').val($.scriptcam.getFrameAsBase64());
document.form.submit();
};