Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <li>
- <label for="first-name">Your code:</label>
- <input type="text" name="code" id="short_link" style="border: 1px solid #3E7EFF; border-radius: 5px 5px 5px 5px;">
- </li>
- <li>
- <div id="gen" style="cursor: pointer";>Generate</div>
- </li>
- $(function() {
- function str_rand() {
- var result = '';
- var words = '0123456789qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM';
- var max_position = words.length - 1;
- for (i = 0; i < 15; ++i ) {
- position = Math.floor ( Math.random() * max_position );
- result = result + words.substring(position, position + 1);
- }
- return result;
- }
- $("#gen").click(function() {
- $("#short_link").val(str_rand());
- });
- });
Add Comment
Please, Sign In to add comment