If it were 2 p...">

Move page by link

I was wondering if anyone knows how, when the link doesn’t move to the send page link ie

<a href="#"></a>

If it were 2 pages down, he would shoot up.

+3
source share
6 answers

If you connected the event to HTML control through jQuery, you can use return falseas

$("#myDiv").delegate("tr", "click", function() {    
     enter code here
     return false;
});
+3
source

No need to replace anchors, as your own answer to the question claims.

This will work just as well:

<a href="#" onclick="yourOwnSubmitFunction(); return false;">

In short, just make sure that any function in the onClick handler returns boolean false.

+2
source

onclick return false; - , , , . , , , , " " .., .

(, SO ) onclick , .:

<span id="potato">Do something</span>
<script type="text/javascript">
    document.getElementById('potato').onclick= function() {
        // do something
    };
</script>

, , .

, <input type="button"> <button type="button">, . , -, CSS , , , . , IE ; .

+2

.net 2.0

MaintainScrollPositionOnPostback

@page, .

, . SmartNavigation.

- , . -, , .

MaintainScrollPositionOnPostback()()() true, .

, location.href .

location.href = "#anchAtPos";

anchAtPos .

0

, :

function anchorReplace()
{
    $("#reportWrapper a").each(function(i){
        var anchorElement = $(this);
        var newAnchorElement = $('<a href="#link' + i + '" name="#link' + i + '">' 
            + anchorElement.text() + '</a>').insertBefore(anchorElement);
        anchorElement.remove();
    });
}
0
source

I fixed it earlier by setting

onclick='return false;'

Inside link

<a href="#" onclick='return false;' id='attachAlistenertothisID'>This link doesn't jump to the top!</a>

I use this for my links that connect to them through jQuery.

Hope this helps someone!

0
source

Source: https://habr.com/ru/post/1718686/


All Articles