$(document).ready(function() {
$(".bubble").click(function() {
// $("input").append(" <b>Appended text</b>");
var x = document.getElementById("input").value;
var y = x + 1;
x = y;
console.log(x);
$('#input').val($('#input').val() + 1);
});
});
.bg {
height: 400px;
background-color: #FFF1F1;
/*display: inline-block;*/
position: relative;
}
.bubble {
height: 30px;
width: 30px;
border-radius: 50%;
background-color: #24E93E;
cursor: pointer;
position: absolute;
bottom: 0;
left: 0;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<div class="container">
<div class="row text-center">
<div class="col-xs-3 btnDiv">
<!-- <button type="button" class="btn btn-danger">STOP</button> -->
<!-- <button type="button" class="btn btn-success">PLAY</button> -->
</div>
<div class="col-xs-6 bg main-block">
<div class="bubble"></div>
</div>
<div class="col-xs-3 score-place">
<input id="input" type="text" name="" placeholder="0">
</div>
</div>
</div>
Here on click, in input, it is starting from 1, but after that it is adding 1 like string. I need to do it as a math +. I am using their jQuery, but it is also ok to write the code just in JavaScript