How can I check an include link button by jquery?

How to check link button or not using jquery.
This is the link button that I want to test.

<asp:LinkButton Enabled="true" ID="LinkButton2" runat="server">LinkButton</asp:LinkButton>

      

+3


source to share


3 answers


try this:



var a = $("#LinkButton2").attr("href");

        if (a!== undefined) {
            alert("true");
        } else {
            alert("false");
        }

      

+1


source


This will work for you

when using attitute id

var isLinkButtonEnabled = $("#LinkButton2[href]") !== undefined ? true : false;

      



when using attitute classname

 var isLinkButtonEnabled = $(".linkClass[href]") !== undefined ? true : false;

      

0


source


You can check it like:

$("#LinkButton2").is(":disabled")

      

Here you will get the Boolean value based on it, which you can find.

-1


source







All Articles