onClick Change Input Value

HTML
<html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script> $(document).ready(function(){ $(".dosomething").click(function(){ $(".deftext").val($(this).attr("my_title")); }); }); </script> </head> <body> <input class="deftext" value="Fred" > <br> <button class="dosomething" my_title="Stupid Face">OK</button> </body> </html>
CSS
JAVASCRIPT
Expand for more options Login