javascript - Click on an anchor not working -
i trying click on anchor, shows type error .. not function.
here code:
file_browser_callback: function(field_name, url, type, win) { win.document.getelementbyid("media").onclick(); win.document.getelementbyid(field_name).value = 'window.send_to_editor'; }, why doing this
i using tinymce editor, , want use file_browser_callback.
there anchor #media in document open thickbox , after selecting image in thick box send callback send_to_editor,
so want value send_to_editor , set
win.document.getelementbyid(field_name).value now getting error:
typeerror: win.document.getelementbyid(...).onclick not function please dont suggest jquery code, need pure javascript (tinymce init dont support jquery)
when event has been bound addeventlistener, running onclick() won't work (as still null)
you try following:
var clickevent = document.createevent("mouseevent"); clickevent.initmouseevent("click", true, true, window, 1, 0, 0, 0, 0, false, false, false, false, 0, null); document.getelementbyid('media').dispatchevent(clickevent);
Comments
Post a Comment