easymar Posted April 28, 2016 Share Posted April 28, 2016 Hello. I have javascript code: function listenMessage(msg) { var product = JSON.parse(msg.data); } and I wanna put variable product.code from this message to: <input id="product" name="product" value="product.code"> I do not know javascript, maybe for someone it is a piece of cake? P.S. I know only how to put this product.code on window popup: function listenMessage(msg) { var product = JSON.parse(msg.data); } alert(product.code); Link to comment Share on other sites More sharing options...
shokinro Posted April 28, 2016 Share Posted April 28, 2016 Based on your code <input id="product" name="product" value="product.code"> and function listenMessage(msg) { var product = JSON.parse(msg.data); } the jquery to set the value to the element is as following $("#product").val(pdocut.code); 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