coffeescript - Call a click on a newly added dom element -



coffeescript - Call a click on a newly added dom element -

im trying phone call click on newly created anchor:

$('.file-status').html("finished downloading <a class='download' download href='#{fileentry.tourl()}'>#{name}</a>") $('.download').click()

but click event not called. not sure why is?

im trying forcefulness download, not open link in browser. dropbox does

edit

here code, more clear:

fileentry.createwriter ((filewriter) -> filewriter.onwriteend = (e) -> $('.file-status').html("finished downloading <a class='download' download href='#{fileentry.tourl()}'>#{name}</a>") $('.download').trigger('click'); filewriter.onerror = (e) -> console.log "write failed: " + e.tostring() filewriter.write blob ), errorhandler

update:

so after understanding answers below not possible, except if server sends info me header content-disposition: attachment. seems me realy bad solutions pure html5 js apps, might offline.

so found this, handles super awesomely! works great. here link:

http://updates.html5rocks.com/2011/08/saving-generated-files-on-the-client-side

hope helps wants same sure there many!

try binding click event anchor tag , phone call click event.

$(".download").bind("click", function (e) { var $a = $(this); window.location = $a.attr("href"); }); $(".download").click();

click coffeescript jquery

Comments

Popular posts from this blog

web services - java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer -

Accessing MATLAB's unicode strings from C -

javascript - mongodb won't find my schema method in nested container -