<tr>
<td>Name:</td>
<td><span id= "keep">Username</span><input id= "change" value= "Name" style= "display:none;"></td>
</tr>
스팬을 숨기고 입력을 표시하려면 어떤 종류의 자바 스크립트가 필요합니까? 이 편집 버튼을 클릭하면됩니다.
<a href="#" data-original-title="Edit this user" data-toggle="tooltip" type="button" class="btn btn-sm btn-warning"><i class="glyphicon glyphicon-edit"></i></a>
이 사이트의 다른 질문에 중복이 있는지 확인했지만 많이 시도했지만 내 질문에 대한 답변이 없습니다!
<html>
<head>
<script>
function showMe(){
document.querySelector('#change').style.display = ''; //Show the input
document.querySelector('#keep').style.display = 'none' //Hide the span
}
</script>
</head>
<body>
<tr>
<td>Name:</td>
<td>
<span id = 'keep'>Username</span>
<input id = 'change' value= 'Name' style= 'display:none;'>
</td>
</tr>
<a href = '#' data-original-title = 'Edit this user' data-toggle = 'tooltip' type = 'button' class='btn btn-sm btn-warning' onclick = 'showMe()'><i class = 'glyphicon glyphicon-edit'>click me</i></a>
</body>
</html>
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다