私はソーシャルWebアプリケーション用のカスタムインターフェイスで作業しています。私はpoisに関する情報を表示するためにinfoWindowsを使用しています。今私はpois情報の一部を編集して保存する可能性をユーザーに与えたいと思っています。 私の問題は、infoWindow内の特定のDOM要素にアクセスできないことです。 ここでは、poisでXMLファイルを解析し、infoWindowsを追加します。infoWindowのgMap 3とjQuery DOMアクセス
function parseXml (xml){
poiXml = xml;
$(poiXml).find("POI").each(function(){
imgs ="";
$(this).find("PhotoFile").each(function(){
imgs += '<tr><td><img src="http://socialdisplay.meinsandkasten.eu/pic/'
+$(this).attr("name")
+'?thumb=1"></td></tr>';
})
myMarkers.push({
lat: $(this).find("Latitude").text(),
lng: $(this).find("Longitude").text(),
data: '<div id="poiWindow" style="padding:40px">'
+'<form id="changeForm">'
+'<table>'
+'<tr>'
+'<th id="poiId" style="display:none">'+$(this).attr("id")+'</th>'
+'<th>Titel:<div id="titleChange">'+$(this).attr("title")+'</div></th>'
+'</tr>'
+'<tr>'
+'<td>Geschichte:<div id="storyChange">'+$(this).find("InformationFile").text()+'</div><td>'
+'</tr>'
+'<tr>'
+'<td>Bildbeschreibung:<div id="descriptionChange">'+$(this).find("PhotoDescription").text()+'</div><td>'
+'</tr>'
+'<tr>'+imgs+'</tr>'
+'<tr>'
+'<td><div id="change">Geschichte ändern</div></td>'
+'</tr>'
+'</table>'
+'</form>'
+'</div>'
})
});
$("#map").gmap3({
action:'addMarkers',
markers:myMarkers,
marker:{
options:{
draggable: false
},
events:{
click: function(marker, event, data){
var map = $(this).gmap3('get'),
infowindow = $(this).gmap3({action:'get', name:'infowindow'});
if (infowindow){
infowindow.open(map, marker);
infowindow.setContent(data);
} else {
$(this).gmap3({action:'addinfowindow', anchor:marker, options:{content: data}});
}
}
}
}
});
}
とマップの初期化と文書レディ機能した後、私はうまくいかない、情報ウィンドウに変更div要素にアクセスしたいです。私は何か基本的なものを逃しています
$("#change").click(function(){
if ($(this).text()=="Geschichte ändern") {
$(this).text("Geschichte speichern");
$("#poiWindow").get(0).contentEditable = "true";
$("#titleChange").get(0).contentEditable = "true";
$("#storyChange").get(0).contentEditable = "true";
$("#descriptionChange").get(0).contentEditable = "true";
// Weitere Befehle, wenn Button aktiv
} else {
$(this).text("Geschichte ändern");
// Weitere Befehle, wenn Button inaktiv
}
})
ありがとうございました。 アンクル