Remove Anchor Link HREF attribute after click using jQuery

Last Reply one year ago By pandeyism

Posted one year ago

disable page navigation and modal popup after first button click how can we disable page navigation and modal popup after first button click... from second click onwards replace above with an alert as alert("pop and navigation is disabled after first click"); .this is a continuation of previous question

<html xmlns="">
<head runat="server">
    <script type="text/javascript" src=""></script>
    <script type="text/javascript" src=""></script>
    <link rel="stylesheet" href="" />
    <script type="text/javascript">
        $(function () {
        function Getproductname(ele) {
            $(".modal-body #lblName").html("Id is :" + $(ele).data('id') + " Name is : " + $(ele).closest('div').find('.sproductname').html());
            $(".modal-body #lblName").css("color", "red");
            if ($(ele).attr("ClickCount") == undefined || $(ele).attr("count") < 1) {
                $(ele)[0].href ="", "_blank", "toolbar=yes");
                 //this code does not works...but it is the model
                 //disable popup also along with disabling navigation links after first click
                 alert("pop and navigation is disabled after first click");//enable this  alert after first click
             $(ele).attr("ClickCount", 1);

        function GetProduct() {
                type: "POST",
                contentType: "application/json; charset=utf-8",
                url: "WebService.asmx/GetData",
                data: {},
                dataType: "json",
                success: function (data) {
                    var table = $('#tblgrid');
                    var rows = "";
                    for (var i = 0; i < data.d.length; i++) {
                        rows += "<div class=trclass>" +
                        "<tr><td class=tdcolumn>" +
                        "<div class=tablediv>" +
                        "<div class=Productid>" + data.d[i].ProductId + "</div>" +
                        "<div class=sproductname>" + data.d[i].ProductName + "</div><br />" +
                        '<p><a class="btn btdeal" target="_blank" onclick = Getproductname(this) data-id="' + data.d[i].ProductId + '" id=btnDeal role="button" data-toggle="modal" data-target="#DesPopUp" >submit</a></p>' +
                failure: function (response) { alert(response.d); },
                error: function (response) { alert(response.d); }
    <form id="form1" runat="server">
        <div class="modal fade" id="DesPopUp" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
            <div class="modal-dialog" role="document">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                            <span aria-hidden="true">&times;</span></button>
                    <div class="modal-body" id="listOfNotes">
                            Some text in the modal.</p>
                        <asp:Label ID="lblName" runat="server" />
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">
        <table id="tblgrid">


This question does not have replies that have been liked.