I have 2 web pages: one acts like the TV and the other as the remote.
This is TV
<!DOCTYPE html>
<html>
<head>
<title>Welcome to RemoteDemo</title>
</head>
<body>
<div id="Tvspace">
<iframe width="560" height="315" src="SomeRandomYoutubeURL" frameborder="0" allowfullscreen></iframe>
</div>
</body>
</html>
And this is the Remote:
<!DOCTYPE html>
<html>
<head>
<title>Remote</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript" src="script.js"></script>
</head>
<body>
<!--Click this to go on the next channel -->
<button id = "next"> Next </button>
</body>
</html>
Whenever I click on the next/previous button I want another iframe to load on the div name "Tvspace" instead of the original.
I tried this but it is opening a new page
$("#next").on('click', function(){
window.location = "http://www.google.com/";
});
I want it to load the contents without refreshing or creating a new page. Thank you.