Bonjour j'aimerais que le bouton ON OFF chane de couleur OFF = rouge et ON = vert. Pourriez vous m'aider sur la syntaxe à ajouter? Comment puis je faire aussi pour que le bouton conserve la même taille quand le texte change. merci bcp
<!DOCTYPE html>
<html>
<head>
<title>
Change the Text of a Button using jQuery
</title>
<script src=
"https://code.jquery.com/jquery-1.12.4.min.js">
</script>
</head>
<body style="text-align:center;">
<button id="F1" style="background-color:red" >OFF</button>
<script>
$(document).ready(function(){
$("#F1").click(function(){
$(this).text($(this).text() == 'OFF' ? 'ON': 'OFF');
});
});
</script>
</body>
</html>