当前位置: 动力学知识库 > 问答 > 编程问答 >

php - Cant seem to get value of input text fields value into hidden form fields using javascript

问题描述:

So I have a fiddle of the code:

http://codepen.io/databaseindays/pen/JGdgq

The idea is that the user can find their coordinates and then submit them via POST variables in hidden fields in the form.

Im using JQuery to simply read the lat and lang fields value into the hidden fields. But the POST variables are always empty. The values are not being copied.

One theory is that I have the hidden fields inside a FORM, while the inputs im trying to copy are not. So first question is, is that a scope issue? If so, should I omit the Form and submit another way, if that will give me access to the values?

Thanks

Norman

网友答案:

OK, you're probably going to kick yourself when you see this. I know it took me a few minutes before I noticed.

It looks as if you're trying to copy the value in the jQuery block at the bottom of the page. However, that bit of code is only running when the document is ready, and NOT when the geocoding operation takes place.

分享给朋友:
您可能感兴趣的文章:
随机阅读: