I created this routine to do a submit and open a page inside a DIV. The javascript recognizes the DIV, but the page is opened overlaying the main page, outside the DIV. Does anyone know what the error could be?
Thanks
<head>
<script>
jQuery($ => {
$('.e-chiedi').on('click', e => {
let $btn = $(e.target);
$.MessageBox({
buttonDone : "Si",
buttonFail : "No",
message : "Mymessage"
}).done(function(){
document.getElementById("formHome").action = "inc_tessera.php#divTessera";
document.getElementById("formHome").submit();
}).fail(function(){
});
});
});
</head>
<body>
<div id="divTessera" style="display: none; ">divTessera</div>
<input id="x" name="x" type="button" class="e-chiedi" data-message="test" />
</body>
When you submit a form (or follow a link) the result will be opened in a browsing context . That can be a window, a tab, or a frame. It cannot be a div.
You can either:
target
attribute on the form
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.