0
こんにちは私は、下記の例button text
の場合、すなわち(そのbutton text
ボタンのテキストを一致させて要素を折り返す方法は?
に対応するので、私はbutton text
がされdiv class
new
として及び場合"Upload"
を追加しています"Download"
あるとbutton
にappend
div
にしようとしています私はappend
いくつか他のdiv class
)。
appending div
についてはwrap APIを使用しています。
は、ここに私のコード
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
</head>
<body>
<button class="btn" title="run">Download</button>
<script>
$(document).ready(function() {
var buttontext = $("button").text();
alert(buttontext);
$('button[text="Download"]').wrap("<div class='new'></div>");
});
</script>
</body>
</html>
である私は、このようなbutton[text="Download"]
button text
を取得しようとしていますが、それは動作しません。
最後に、私はこの
<div class="new">
<button class="btn" title="run">Download</button>
</div>
のような出力が何か任意の助けが理解されるであろう欲しいです。