JSFiddle - React, Tailwind, and code Playground
by abdullahdiaa
HTML
<div id="textbtn0">Btn1</div>
<div id="textbtn1">Btn2</div>
<div id="textbtn2">Btn3</div>
<div id="textbox">This is text</div>
JavaScript
jQuery(document).ready(function() {
var newsItems=new Array();
newsItems[0]="News1";
newsItems[1]="News2";
newsItems[2]="News3";
$.each( newsItems, function(i, l){
$("#textbtn"+i).mouseover(function() {
$("#textbtn"+i).css('cursor', 'pointer');
});
$("#textbtn"+i).click(function(){
$("#textbox").html(newsItems[i]);
});
});
});