0

현재 수. 버튼 코드는 다음과 같습니다.bootsrap 모달 대화 상자에서 버튼을 비활성화하는 방법은 무엇입니까? 다음 코드</p> <pre><code>modal.find('.modal-body #transfer').prop('disabled', true) </code></pre> <p>그러나 위의 버튼이 작동하지 않습니다와 입력 필드를 사용하지 않도록 설정하는

<button id="transfer" type="button" class="btn bg-orange btn-flat" onclick="transfer()" >Transfer</button> 
+0

버튼에 대한 정확한 명령은 무엇입니까? 그것은'.prop ("disable", true)'와 함께 작동해야합니다. – David

+0

버튼은 onlick을 통해 기능을 실행합니다. 이것들은 모두 내 코드입니다. 상위 두 개는 입력 필드와 드롭 다운을 처리하지만 세 번째 버튼은 어떤 이유로 작동하지 않습니다. prop ('disabled', true) modal.find ('modal-body #reasonrisowner') modal.find ('modal- '.modal-body #transfer'). prop ("disabled", true) – Shuyaib

+0

Ok nvm. disabled는 작은 따옴표 대신 큰 따옴표를 사용해야했기 때문에 지금은 효과가있었습니다. – Shuyaib

답변

0

을 해제하려면 아래의 코드를 사용합니다. 큰 따옴표 여야합니다.

0

버튼에 disabled 속성을 사용해야합니다. attr() 코드로 다음 기능을 시도해보십시오.

modal.find('.modal-body #transfer').attr('disabled', true); 
+0

그게 정확히 내가 사용하는거야. – Shuyaib

+0

주어진 코드에서'attr'없이'prop'를 추가했습니다. – Thusitha

0

은 여기 솔루션

$('.modal').find('button#transfer').prop('disabled', 'disabled'); 

예 솔루션이 도움이 될 것입니다

$('.modal').find('button#transfer').prop('disabled', 'disabled');
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/> 
 
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> 
 
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> 
 
<!-- Trigger the modal with a button --> 
 
<button type="button" class="btn btn-info btn-lg" data-toggle="modal" data-target="#myModal">Open Modal</button> 
 

 
<!-- Modal --> 
 
<div id="myModal" class="modal fade" role="dialog"> 
 
    <div class="modal-dialog"> 
 

 
    <!-- Modal content--> 
 
    <div class="modal-content"> 
 
     <div class="modal-header"> 
 
     <button type="button" class="close" data-dismiss="modal">&times;</button> 
 
     <h4 class="modal-title">Modal Header</h4> 
 
     </div> 
 
     <div class="modal-body"> 
 
     <p>Some text in the modal.</p> 
 
     </div> 
 
     <div class="modal-footer"> 
 
     <button id="transfer" type="button" class="btn bg-orange btn-flat" onclick="transfer()" >Transfer</button> 
 
     </div> 
 
    </div> 
 

 
    </div> 
 
</div>

희망과 함께 할 것입니다.

0

이 문제는 작은 따옴표로 사용할 명령을 사용하여 있던 버튼 -

$('#transfer').prop('disabled',true); 
관련 문제