私はスパンで書かれたいくつかの単語を持つ段落を持っています。これをクリックすると編集できます。コンテンツは動的に呼び出され、現在の方法は機能しません。あなたは私にそれを行うためのよりよい方法を提案することができますか?ここ はフィドルです:http://jsfiddle.net/9dq2p7dw/109/ 感謝:)動的コンテンツ用のJquery
<h4>Currently working in <span class="editor">xyz*</span><span style=
"display:none;" class="edit"><input type="text" class="form-control input-
sm" id="edited" style="width:100px;z-index: 100;background: white;display:
inline;"></span><button type="submit" id="submit" class="edit"
style="display: none;">save</button>
for past <span>0-5 years*</span>.Studied Graduation from <span>ABC.</span>, 12th from <span>jnnj</span> with <span>80%</span>, 10th from <span>Bkbjkjnk</span> with <span>80%</span></h4>
、ここではそれのためにjqueryのです。
$(document).ready(function(){
$('.bizcontent').click(function(){
$('#myModal2').modal('toggle');
});
$(".editor").click(function(){
$(".edit").show();
$(".editor").hide();
var edit = $("#edited").val();
});
$("#submit").click(function(){
var edit = $("#edited").val();
var ans = confirm("Update your input as "+ edit + " ?");
if (ans== true) {
$(".edit").hide();
$(".editor").replaceWith("<span class='editor'>" + edit + "</span>");
$(".editor").show();
}
else{
$(".editor").show();
$(".edit").hide();
}
});
});
何をして動作していませんか?あなたはどんな結果を望んでいますか? – Sojtin
私はそれがすべてのスパン要素のために働きたい。 –