Open all pages on index page in sertain div [on hold]

45
September 03, 2019, at 6:00 PM

I have a index.html page with multipe links (only showing 3 here). Herefore I used php GET page to open all the links in a div. Since I can't use php (@ work and no server) I need a work around.

I googled for more information, but the code I found didn't work for me

<html>
<li><a href="home.html">home</a></li>
<li><a href="planning.html">Planning</a></li>
<div id="page"></div>
</html>

So the home page needs to open automatically when I open the index page, all other (future) links need to open in the "page" div.

Answer 1

Option 1

Load it via an iframe using the target attribute in the href and a named and id'd iframe

<html>
<li><a target="page" href="home.html">home</a></li>
<li><a target="page" href="planning.html">Planning</a></li>
<iframe id="page" name="page"></iframe>
</html>

Option 2

You may also use jQuery to load the page into a div.

<html>
<li><a href="home.html">home</a></li>
<li><a href="planning.html">Planning</a></li>
<div id="page"></div>
<script
  src="https://code.jquery.com/jquery-3.4.1.min.js"
  integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo="
  crossorigin="anonymous"></script>
<script>
    $('a').on('click', function(){
        let url = $(this).attr('href');
        $.get(url, function(data, textStatus, jqXHR){
            $('#page').html(data);
        });
        return false;
    });
</script>
</html>
READ ALSO
Change width of all elements in loop separately with jQuery [on hold]

Change width of all elements in loop separately with jQuery [on hold]

I have a Wordpress custom post type for teammembers, and want to show them in a masonry layout using flexbox

53
Toggle checked radio button on click div [on hold]

Toggle checked radio button on click div [on hold]

I use two divs as buttons and use jquery toggle active on event clickCan anyone help me to add attribute checked to radio button inside those two divs?

58
Why does the jquery change event not trigger when I set the value of a select using val()?

Why does the jquery change event not trigger when I set the value of a select using val()?

The logic in the change() event handler is not being run when the value is set by val(), but it does run when user selects a value with their mouseWhy is this?

74
Edit and Delete buttons are not working in form how to fix it

Edit and Delete buttons are not working in form how to fix it

The code is incorrect for edit button when click on edit button it has to show the data of person which we clicked, and delete button also has to delete the selected person's data can't solve this issue buttons are not working properly give some advice...

44