0

I need to call a functoin on button click and pass the value of id into that function...here is what I m doing ...but I bet i m doing sth wrong bcoz its not working

function Datarate(frm) {

    var ar = document.getElementById('<%= submit.ClientID%>');
    alert(ar);
}

<asp:Button runat="server" ID="submit" Text="Submit" OnClientClick="return Datarate(this.form);" PostBackUrl="www.google.com" /> 

but i m getting alert as null...

any idea where I m getting wrong... Thanks,

1 Answer 1

1
var ar = document.getElementById('<%= submit.ClientID%>').value;
alert(ar);

Try adding .value

Sign up to request clarification or add additional context in comments.

1 Comment

I tried this and its showing document.getElementById('<%= submit.ClientID%>') is null

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.