I've been trying to randomize a number with a button, but every time I clicked the button, the number randomizes, but the text loses it's CSS style.
CSS
.numberStyle {
padding: 10px 10px 10px 10px;
color: blue;
}
.numberStyle span {
font-size: 100px;
}
Html
<class id="number1" class="numberStyle"><span>1</span></class>
<input type="button" value="MATCH!" style="font-size:50px;"></input>
Javascript
function randomize() {
no1 = Math.ceil(Math.random() * 3);
}
function print() {
$("#number1").text(no1);
}
$().ready(function() {
$(":input").click(function() {
randomize()
print()
alert("Change")
})
})
my JSFiddle link : https://jsfiddle.net/he4rtbr0ken/9jfud4nz/2/