javascript - How to create a link in jQuery in a valid way? -
at this site, blogger suggest creation of link using syntax below.
$('<a>clicky clicky</a>', { href: datalink, download: filename });
however, don't work. need use syntax follows.
$('<a href="' + datalink + '">clicky clicky</a>');
not being familiar former, wonder if i'm missing something. valid jquery?
also, tha tbegs question of download attribute. first line of code equivalent 1 below? have feeling it's not.
$('<a href="' + datalink + '" download="' + datalink + '">clicky clicky</a>');
use prop()
:
var link = $('<a>clicky clicky</a>').prop({href: datalink, download: filename}); var link = $('<a>').prop({href: datalink, download: filename , text:'clicky clicky'});
Comments
Post a Comment