1
I have a javascript method on a button, which is triggered with the click of it, but this same button triggers an Asp.net event. The js event executes a method that processes a value and this value I play within a Hidden (Asp). The Asp event uses this value (from Hidden) for another process. My problem is that it seems that the Asp event is processing before JS so when Asp tries to get the value generated by JS (which should be in Hidden), the value is empty.
Any idea how to run js first in this case? or any other idea?
document
.getElementById("ContentPlaceHolder1_cmdAvancarEndereco")
.addEventListener("click", getHashSender);
Private Sub cmdAvancarEndereco_Click(sender As Object, e As EventArgs)
Handles cmdAvancarEndereco.Click
<asp:button ID="cmdAvancarEndereco" runat="server"
cssclass="btn btn-success btn-lg" text="Avançar >">
</asp:button>
What is your code?
– novic
Document.getElementById("Contentplaceholder1_cmdavancarendereco"). addeventlistener("click", getHashSender); <- JS
– Jhonatan Jorge de Lima
ContentPlaceHolder1_cmdAvancarEndereco
is a buttonsubmit
?– novic
Guy sorry that’s the code : Document.getElementById("Contentplaceholder1_cmdavancarendereco"). addeventlistener("click", getHashSender); <- JS Private Sub cmdAvancarEndereco_Click(Sender As Object, and As Eventargs) Handles cmdAvancarEndereco.Click 'event end sub the forward knob and a knob Asp <Asp:button ID="cmdAvancarEndereco" runat="server" cssclass="btn btn-Success btn-lg" text="Next >"></Asp:button> 
)
– Jhonatan Jorge de Lima
just click on the editor where the keys are
{ }
the text needs to be selected. In your case the Button requests the server first, javascript does not even execute, I believe. It’s kind of without context but, that would be it.– novic
but I say here in the comments, or there is no way?
– Jhonatan Jorge de Lima
has yes is
com dois acentos crase
– novic