Link to home
Start Free TrialLog in
Avatar of ApexCo
ApexCoFlag for United States of America

asked on

Firing jQuery on key press action

I'm trying to get this to fire using "onkeyup", here is my setup. My field is not getting set, not sure where my mistake is.


function setDirty(changeVal) {
                $('<%=dirtyField.ClientID %>').val(changeVal);
            }

<asp:HiddenField ID="dirtyField" runat="Server" />

                //set attributes for dirty detection in data changes
                txtReason.Attributes.Add("onkeyup", "setDirty(true);");
                txtAWB.Attributes.Add("onkeyup", "setDirty(true);");
                txtERP.Attributes.Add("onkeyup", "setDirty(true);");
                ddlPriority.Attributes.Add("onclick", "setDirty(true);");
                ddlCarrier.Attributes.Add("onclick", "setDirty(true);");

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Eduardo Ciciliato
Eduardo Ciciliato
Flag of Brazil image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Avatar of leakim971
leakim971
Flag of Guadeloupe image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
well done @usmansirajs !



function setDirty(changeVal) {
    $('#<%= dirtyField.ClientID %>').val(changeVal);
}

Open in new window

Avatar of ApexCo

ASKER

Here is final solution.



$(function setDirty(changeVal) {
                $('#<%= dirtyField.ClientID %>').val(changeVal);
            });

Open in new window

thanks for the points!