i have many posts unique statusid numbers associated them. each post has 'share' button , textfield current posts unique url in textfield value.
i want 'share' buton, on click, highlight url text of accompanying textbox, unique post
so far have butt isnt working
<input type="button" value="share" onclick="shareurl"> article address:<input type="text" value="blog.php?id='.$statusid.'" name="urlbox'.$statusid.'"> function shareurl(statusid) { ("urlbox"+statusid).focus(); ("urlbox"+statusid).select(); }
statusid unique each post im trying use highlight correct textbox url
simply may follow following demo native javascript solution, i.e not need third party libraries such jquery:
<!doctype html> <html> <head> <meta charset="utf-8"> <title>js bin</title> <script> function sel(id){ ob = document.getelementbyid(id); ob.select(); } </script> </head> <body> <input id="i" type="text" value="somthing selected" /> <input type="button" value="select" onclick="sel('i')" /> </body> </html>
you define input field id
make function input field
object , apply method select()