0
私のHTMLとjqueryコードは以下のようになりますが、何らかの理由でスパンのテキストを変更できます。私はfindメソッドとnearestメソッドの両方で試しています。何か案は?おかげjqueryを使用してスパンテキストを検索および変更できません
<body>
<span class="classA">Text A</span>
<input id="testId" type="file" name="files" class="fileUp">
<span class="classA">Text B</span>
<script type="text/javascript">
$(document).ready(function() {
$("input.fileUp").change(function (event) {
$(this).closest('span.classA').text('testing');
$(this).find('span.classA').text('testing');
});
});
</script>
</body>
使用:$(この).parent()( 'span.classA')を見つけるテキスト( 'テスト');。。 –