javascript - Possible to change location.href of a div without using iframe? -
i want try this, change href location specific div. know can use iframe trying avoid frames. there way accomplish this, user click button , source of single div changes rest of site stays same.
<script> function chdiv() { document.getelementbyid("div2").location.href="google.com"; } </script> <div id="div1"> <button id="change" onclick="chdiv();" </div> <div id="div2"> <div>
no, , divs don't have location
property. may doing ajax request bring in whatever html need.
$.get('url', function (data) { $('#div2').html(data); });
Comments
Post a Comment