大家好,这里需要一点帮助。 我正在创建一个动态表单,并且在使用jquery获取HTML标签值方面遇到了一些麻烦。我拥有的是一张表格,里面是Google Map。每次Google地图更新时,它都是当前的经纬度,它当前的经纬度标签也在变化。我需要做的是获取当前的经纬度并将其显示在文本框中。改变的文本框的值也必须是动态的。如何在标签值发生变化时使用jquery事件?
在我的代码中,我有这个。
$(document).ready(function(){
var current_latitude = $('#company_geo_lat').val(); //this is the textbox
var current_longitude = $('#company_geo_long').val(); //this is the textbox
var new_latitude = $('.new_latitude').html(); //this is the label
var new_longitude = $('.new_longitude').html(); //this si the label
});
我应该怎么做才能动态替换文本框的值?我不想使用onchange事件,但我不知道。
好的,我会尝试。 :) – Jerielle