0

クラス「gmapItems」で要素を動的に作成しています。そして、これらの要素の配列をそれぞれにエクスポートする必要があります。

何か案は?

HTML:

<div class="gmapItems">
<input type="text" class="input-medium googleMapCity" value='1'>
<input type="text" class="input-medium googleMapAddress" value='1'>
<textarea class="input-medium googleMapInformation" value='1'></textarea>
</div>

<div class="gmapItems">
<input type="text" class="input-medium googleMapCity" value='2'>
<input type="text" class="input-medium googleMapAddress" value='2'>
<textarea class="input-medium googleMapInformation" value='2'></textarea>
</div>

Jクエリ:

    $("#AddGoogleMap").on('click', function () {            
    mapMarkers = new Array();
    $('.gmapItems').each(function(){
    gmapCity = $('.googleMapCity').val();
    gmapAddress = $('.googleMapAddress').val();
    gmapInfo = $('.googleMapInformation').val();  
    mapMarkers.push(gmapCity, gmapAddress, gmapInfo); 
    alert(mapMarkers)
    });
4

1 に答える 1