Skip to content

Instantly share code, notes, and snippets.

@bcostea
Created July 10, 2017 13:20
Show Gist options
  • Save bcostea/cc1ef4af74a881f4996d49d0919832e5 to your computer and use it in GitHub Desktop.
Save bcostea/cc1ef4af74a881f4996d49d0919832e5 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Example of Bootstrap 3 Prepended and Appended Inputs</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<style type="text/css">
.bs-example{
margin: 20px;
}
</style>
</head>
<body>
<div class="bs-example">
<form>
<div class="input-group">
<input id="link_to_open" type="text" class="form-control" placeholder="Username">
<span class="input-group-addon">
<a onclick="openLink('link_to_open')"> <span class="glyphicon glyphicon-link"></span></a>
</span>
</div>
</form>
</div>
<script>
function openLink(link_input){
window.open($("#"+link_input).val());
}
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment