2013-01-17 3 views
2

아이콘을 클릭하려고하면 클릭 한 항목과 관련된 메시지를 표시하는 jQuery 대화 상자를 트리거합니다. jQuery에 익숙하지 않기 때문에 저는 운이 전혀 없습니다. 누군가 내가 뭘 잘못하고 있는지 말해 줄 수 있습니까? ASP를 MVC보기jQuery 대화 상자에서 onlcik을 실행하십시오.

<td> 
    @if (!String.IsNullOrWhiteSpace(item.Notes)) 
    { 
     <span id="notes" onclick='GetNotes(@id);'> 
      <img src="@Url.Content("~/Content/images/magnify.gif")" alt="Show Notes" /> 
     </span>   
    } 

     <div id="@id" style="display:none;"> 
      @Html.DisplayFor(modelItem => item.Notes) 
     </div>  
    </td> 

jQuery 코드에서 코드의

섹션 :

<link rel="stylesheet" href="http://code.jquery.com/ui/1.9.2/themes/base/jquery-ui.css" /> 
<script src="http://code.jquery.com/jquery-1.8.3.js"></script> 
<script src="http://code.jquery.com/ui/1.9.2/jquery-ui.js"></script> 
<script src="@Url.Content("~/Scripts/jquery.tablesorter.min.js")" type="text/javascript"></script> 
<script type="text/javascript"> 
    $(document).ready(function() { 
     $("#thetable").tablesorter(); 
    } 
    ); 

    function GetNotes(id) { 
     $(function GetNotes() { 
      $("#" + id + "\"").dialog(); 
     }); 
    } 

</script> 

편집

는 onlick 메소드 이름은 이전에 오류가 포함되어 있습니다. 추가 ')'가있었습니다.

답변

2

GetNotes 함수 내에서 꽤 깨진 자바 스크립트가 있습니다. 다음과 같이 시도하십시오.

function GetNotes(id) { 
    $('#' + id).dialog(); 
} 

브라우저에서 자바 스크립트 디버깅 콘솔을 시청하십시오. 그것은 당신에게 오류를 보여줍니다.

+0

고맙습니다! 나는 또한 onlick 전화 오타 이온했다. 추가 ')'가 있습니다 – NealR

+0

예, 처음에는 알지 못했습니다. js 콘솔을보십시오. 그것은 모든 것을 알려줍니다. –

관련 문제