What would be a javacode to trigger another element using toolbox

Hi there! Maybe anyone would be able to tell what would be a javacode to trigger another element? I need to trigger a picture uploader by clicking another button. I have tried

document.getElementById(“photoclick”).click();
and
$( “#myElement” ).click();
however I couldn’t make it work.

Maybe @mishav you could help to sort this out?

Thanks!

If you set the id attribute to mypicuploader …

$('#mypicuploader input').click()

This kind of works, but depends on the permissions of the Browser, it won’t work if popups are disabled, because the click is coming from a script instead of the user.

To be more reliable, it’d be better to create a plugin to do similar functionality to the picture uploader.

1 Like

Hi @mishav
had try your js code for pic uploader and it works. But then I need to use multifile uploader (plugin) element too. Could you help a js for this one. Hope you can help since i have nothing with code.

Thanks.