HTML Code
<html lang=”en”>
<head>
<meta charset=”UTF-8″>
<meta name=”Generator” content=””>
<meta name=”Author” content=””>
<meta name=”Keywords” content=””>
<meta name=”Description” content=””>
<title>Document</title>
<script src=”jquery.js”></script> // Give path of jQuery Latest file
</head>
<body>
<div id=”addClassHere“>Hello Garry</div>
</body>
jQuery Code
$( “#addClassHere” ).addClass( “selected” );
</script>
</html>
On page load, this class will automatically be added to the div with id “addClassHere”
Leave a comment