Quantcast
Channel: jQuery Library for SharePoint Web Services
Viewing all articles
Browse latest Browse all 6517

New Post: Disabling page links

$
0
0
The onclick is firing even though you are removing it from the code. Once you click it, it fires, then you remove the onclick function. What I would suggest is to cache and remove all of your onclick's upon $(document).ready. Once those are cached and removed, then you can use the code Marc provided above.

Example:
jQuery(document).ready(function($) {
    var $links = $("td.ms-vb a")
    
    $links.each(function() {
        var $this = $(this)
        
        ;

        // Cache onclick handler.
        // Remove the default onclick.      
        $this.data('onclick', this.onclick);
        // $this.data("onmousedown", this.onmousedown);
        // $this.data("onfocus", this.onfocus);

        
        this.onclick = $.noop;
        // this.onmousedown = $.noop;
        // this.onfocus = $.noop;
    });
    
    $links.on("click", function(event) {

        event.preventDefault();
        // Do what you want here        
    }); 
});
Cheers,
Matthew

Viewing all articles
Browse latest Browse all 6517

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>