Skip to content

Instantly share code, notes, and snippets.

@aldajo92
Created September 15, 2017 04:11
Show Gist options
  • Save aldajo92/e0eaeee7df2b04c5eeb325a06e112747 to your computer and use it in GitHub Desktop.
Save aldajo92/e0eaeee7df2b04c5eeb325a06e112747 to your computer and use it in GitHub Desktop.
var doc = $(document);
doc.ready(function(){
$("#buttonio1").click(function(){
// alert("The paragraph was clicked.");
window.open("https://www.google.com","_self")
});
});
/*document.getElementById("buttonio1").addEventListener("click", function(){
document.getElementById("demo").innerHTML = "Hola Boton";
});*/
/*function myFunction() {
document.getElementById("demo").innerHTML = "Casa";
}*/
<!DOCTYPE html>
<html>
<body>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<style>
.button {
background-color: #0000ff;
border: none;
color: white;
padding: 15px 32px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
margin: 4px 2px;
cursor: pointer;
}
</style>
<p>Click the button to trigger a function that will output "Hello World" in a p element with id="demo".</p>
<button onclick="myFunction()" class="button">Click me</button>
<button id="buttonio1" class="button">Try it</button>
<p id="demo"></p>
<script src="file.js">
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment