Skip to content

Instantly share code, notes, and snippets.

@elephantatech
Created March 23, 2016 16:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elephantatech/3fd5f9dae2c40a584c61 to your computer and use it in GitHub Desktop.
Save elephantatech/3fd5f9dae2c40a584c61 to your computer and use it in GitHub Desktop.
HTML5 bootstrap button example that allows to update text within a tag with an id
<!DOCTYPE html>
<html lang="en">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container">
<button type="button" class="btn btn-primary" onclick="changeText(addinfo,'checking mangoes')">Check</button>
<button type="button" class="btn btn-default" onclick="changeText(addinfo,'processing mangoes')">Button</button>
<button type="button" class="btn btn-danger" onclick="changeText(addinfo,'Cleaning mangoes stay clear')">Button</button>
<button type="button" class="btn btn-success" onclick="changeText(addinfo,'mangoes are great')">Button</button>
</div>
<article id="addinfo">
</article>
</body>
<script>
function changeText(id,text) {
id.innerHTML = text;
}
</script>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment