unplugged_web Posted January 12, 2016 Share Posted January 12, 2016 How do I change the text of this? I'm getting the id of a button (which works) but when I try to change it the console outputs the buttons value instead. This is what I've got: $j(this).attr('id'); var $buttonID = $j(this).val(); $buttonID = $buttonID.replace("change","data"); console.log($buttonID); if I do this though the alert box shows the buttons id: alert($('.change').attr('id')); Link to comment Share on other sites More sharing options...
unplugged_web Posted January 12, 2016 Author Share Posted January 12, 2016 I changed the code to this: var $buttonID = $j(this).attr('id'); $buttonID = $buttonID.replace("change","data"); console.log($buttonID); and it now worksde to this: var $buttonID = $j(this).attr('id'); and it now works 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