"Bootstrap 3 Buttons"
Bootstrap 3.1.0 Snippet by muhittinbudak

<link href="//netdna.bootstrapcdn.com/bootstrap/3.1.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="//netdna.bootstrapcdn.com/bootstrap/3.1.0/js/bootstrap.min.js"></script> <script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <!------ Include the above in your HEAD tag ----------> <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Strait"> <body> <div class="container" style="font-family: 'Strait', sans-serif;"> <h2 class="text-center">Test</h2> <h4 class="text-center" id="sonuc">area</h4> <hr style="width:50%"> <div class="form-group row"> <div class="col-xs-10"> <input type="text" class="form-control input-lg" id="inputText" placeholder="#inputText"> </div> <div class="col-xs-2"> <button class="btn btn-danger btn-lg btn-block" id="tiklaBtn1">#tiklaBtn1</button> </div> </div> <span id="info" style="font-size:18px" class="label label-danger strait">#info</span> <br/><br/> <div class="well well-lg text-success clearfix"> <span id="result" style="line-height:34px;font-size:20px">#result</span> </div> <div class="well well-lg text-success clearfix"> <span id="result1" style="line-height:34px;font-size:20px">#result1</span> </div> </div> </body>
$(document).ready(function () { var sonuc = $('#inputText').val(); /* $("#tiklaBtn1").click(function () { sonuc = !sonuc; if(sonuc){ bolum1("EVET"); } else { bolum2("HAYIR"); } }); */ function bolum1(text) { $("#result").html(text).css("color","red"); } function bolum2(text) { $("#result").html(text).css("color","green"); } //-------- Conditional (ternary) operator //https://www.geeksforgeeks.org/javascript/javascript-ternary-operator/ $("#tiklaBtn1").click(function () { ( sonuc=!sonuc ) ? bolum1("evet") : bolum2("hayır"); }); });

Related: See More


Questions / Comments: