Skip to content

Instantly share code, notes, and snippets.

@SebDeclercq
Created March 16, 2017 19:19
Show Gist options
  • Select an option

  • Save SebDeclercq/2a5032c729a4dd300e5be8f02f6a50fc to your computer and use it in GitHub Desktop.

Select an option

Save SebDeclercq/2a5032c729a4dd300e5be8f02f6a50fc to your computer and use it in GitHub Desktop.
<html>
<body>
<script src="https://code.jquery.com/jquery-1.12.4.min.js" integrity="sha256-ZosEbRLbNQzLpnKIkEdrPv7lOy9C27hHQ+Xp8a4MxAQ=" crossorigin="anonymous"></script>
<script>
function Personne(prenom, nom) {
this.nom = nom
this.prenom = prenom
this.say = function(verbe='Hello') {
alert(verbe+' '+this.prenom+' '+this.nom.toUpperCase())
}
}
</script>
<script>
$(document).ready(function() {
$("#submit").on('click', function() {
var pers = new Personne(
$("input[name=nom]").val(),
$("input[name=prenom]").val()
)
pers.say()
})
})
</script>
<input type="text" name="nom" placeholder="nom"/><br/>
<input type="text" name="prenom" placeholder="prenom"/><br/>
<button id="submit">new</button>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment