1

드롭 다운의 값이 변경 될 때 부트 스트랩에서 모달 팝업을 생성하는 방법은 무엇입니까?드롭 다운의 값이 변경 될 때 부트 스트랩에서 모달 팝업을 생성하는 방법은 무엇입니까?

난 .. 난이 modalPopup

$("#City").change(function() { 
    if ($("option:selected", $("#City")).text() == "Others") { 
     alert("hi"); 
     showModalPopup(); 
    } 
}); 


function showModalPopup() { 
    $("#myModal").modal("show"); 
} 

내가 경고를 얻고있다하지만 난 모달 팝업을 볼 수 없습니까에게 보여주기 위해 이벤트를 제기하고이처럼 내 자바 스크립트가 있습니다.

는 그리고이

<div id="myModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> 
<div class="modal-header"> 
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> 
    <h3 id="myModalLabel">Modal header</h3> 
</div> 
<div class="modal-body"> 
    <p>One fine body…</p> 
</div> 
<div class="modal-footer"> 
    <button class="btn" data-dismiss="modal" aria-hidden="true">Close</button> 
    <button class="btn btn-primary">Save changes</button> 
</div> 

내가 호야가 나를 도와 부트 스트랩에 새로운 오전 부트 스트랩 예에서 해당 팝업에 대한 HTML 코드입니다.

+0

및 위치 드롭 다운이 작동

$("#City").live("change", function() { var changeCity = ""; changeCity = $("#City option:selected").val(); if (changeCity == "Others") { alert("hi"); showModalPopup(); } }); function showModalPopup() { $("#myModal").modal("show"); } 

희망 당신의 드롭 다운 변경 이벤트에 대한 변수를 추가 ?? – shemy

+0

내 cshtml 페이지에 있습니다. @ Html.DropDownListFor (C => c.City, new [] {새로운 SelectListItem() {Text = "", Value = ""}}, "도시 선택") .. 내가 가진 동일한 페이지 팝업창 –

+0

'showmodalPopup()'을'$ ("myModal")로 바꾸려고 했습니까? modal ("show");'?? –

답변

1

먼저이 :)

+0

아니, 그건 도움이 안돼 !! –

+0

내 새 편집을 시도하십시오 –

+0

그 답장을 보내 주셔서 감사합니다 bootstrap.anywayz의 사용법에 문제가 ... 나는 편집 한 방법으로도 확인했습니다 –

관련 문제