Go to url

$(document).ready(function(){ //#gotourl - trigger function $("#gotourl").on("click", function(){ var mainLink = "https://www.google.gr/?gfe_rd=cr&ei=ITEdVqewApO-oQfWm4bIDw&gws_rd=ssl#q=";//url var url = ($("#url").val()).toString();//value from input field $("#result").text(mainLink+url);//result window.location.href = mainLink+url;//redirect to concatenated url }); }); //Example of HTML markup /* <div class="container-fluid"> <div class="row"> <h1 class="text-center">URL How to</h1> <div class="col-sm-6"> <input type="text" class="form-control" id="url" placeholder="type what do u want! Bitch" /> <button id="gotourl" class="btn-success btn">Go to URL</button> </div> <div class="col-sm-6"> <pre id="result"></pre> </div> </div> </div> */
Current snippet redirects you to specific url with input value.

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.