I am trying to write a bookmarklet to populate the Wordpress image gallery manager, clicking an image pops up the sidbar with these fields,there are alt (input), legend,and description, both are textarea. my Js snippet is:
<a href="javascript:var t=document.querySelectorAll('div.media-sidebar label input');var a=t[2];var u=document.querySelectorAll('div.media-sidebar textarea');var b=u[0];var v=document.querySelectorAll('div.media-sidebar label input');var c=u[1];a.value='Hello';">Duplicate</a>
When I click the link, i am redirected to a new page, with the text i want to set. How to do it correctly, i don't know why i am being redirected. thanks.