What i wanted is that a button that changes the para into bold and after 5 seconds the whole page is refreshed.Have a look into my code here.But what is happening is that its getting bold and the page is getting refreshed in less than a second.
var btn = document.getElementById('button_1');
var para = document.getElementById('content');
btn.addEventListener('click', function ab() {
//Change the font weight style to 700
para.style.fontWeight = '700';
});
btn.addEventListener('click', function aq() {
setTimeout(location.reload(), 5000);
});
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<p id="content">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>
<table border="1">
<tr>
<td>
Press the following buttons to make changes accordingly.
</td>
</tr>
<tr>
<td><button id="button_1" >Bold</button></td>
<td><button id="button_2">underline</button></td>
<td><button id="button_3">Align to left</button></td>
<td><button id="button_4">Align to right</button></td>
</tr>
<tr>
<td><button id="button_5">Align to center</button></td>
<td><button id="button_6">Align as justified</button></td>
<td><button id="button_7">Uppecase</button></td>
<td><button id="button_8">Lowercase</button></td>
</tr>
</table>
<script src="a1.js"></script>
</body>
</html>