I want to do a basic replaceWith operation in JQuery and it won't work.
Here is the html.
<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script>
function changeCAT(){
$('#avg_scores').replaceWith('<div>Replacement Success!</div>');
};
$('#btn').click(changeCAT);
</script>
</head>
<body>
<input id = "btn" type = "button" value = "Change Div">
<div id = "avg_scores"> Original Div</div>
</body>
</html>
However when I press the button, nothing happens. I want to replace something much more significant in the final product, but I can't get this simple operation to work means I am doing something fundamentally wrong.