funbinod Posted September 24, 2014 Share Posted September 24, 2014 i'm trying to change the submit button's value and style on certain condition using the following code <script>$(document).ready(function() { $("#conpass").keyup(function() { if ($("#uok").val()=="ok" && $("#compok").val()=="ok" && $("#passok").val()=="ok" && $("#cpok").val()=="ok") { $("#register").removeAttr('disabled'); $("#register").addClass('enabled'); $("#register").removeAttr('value'); $("#register").addAttr('value', 'Register'); $("#register").removeClass('disabled'); } })});</script> everything is working fine but addAttr('value', 'Register') is not working. after removing the default value, it changes it to 'Submit'. but I wish to change it to 'Register'. please guide what I did wrong......... Link to comment Share on other sites More sharing options...
Ingolme Posted September 24, 2014 Share Posted September 24, 2014 It's probably that the attribute isn't directly affecting the value property, just the DOM tree. I think jQuery has a .val() method: $("#register").val("Register"); 1 Link to comment Share on other sites More sharing options...
dsonesuk Posted September 24, 2014 Share Posted September 24, 2014 Look at jquery for correct method for adding, updating and removing attributes. Link to comment Share on other sites More sharing options...
funbinod Posted September 24, 2014 Author Share Posted September 24, 2014 thank u ingoime. it did work. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now