2012-10-23 4 views
0

레일 3 부분에서 작동하도록 간단한 input.hover를 얻을 수 없습니다. 여기 여기 내 부분 _lookupshow.html.erbjquery-ui가 레일 부분에서 작동하지 않을 수 있습니다.

I threw the js include tags in the partial to see if that was the problem, it was 
not the problem 

<%= javascript_include_tag "jquery-ui-1.8.10.custom.min.js", "jquery.ui.mouse.min.js" %> 
<table id="sortable" class="lkupdata"> 
    <tbody class="lkuptbody"> 
     <% @lookuprows.each do |lkup| %> 
      <tr class="lkuprow"> 
       <td> 
        <input type="text" class="lkupcode" value="<%= lkup.codetype %>"/> 
       </td> 
       <td> 
        <input type="text" class="lkupdesc" value="<%= lkup.codedesc %>"/> 
       </td> 
      </tr> 
     <% end %> 
    </tbody> 
</table> 

인 application.js에서 jQuery 코드, 난 lookup.js이 코드를 이동하고 그것은 여전히 ​​작동하지 않았다.

$('.lkupcode').load(function(){ 
    $('.lkupcode').hover(function(){ 
     alert("This is working"); 
    }); 
}); 

위 코드는 document.ready 섹션에 있었지만 .load 섹션으로 옮겼습니다. 이 단순한 것이 작동하지 않는 이유는 무엇입니까? 감사합니다 ...

답변

0

내가하지 당신이 문서에 jQuery를 UI를 포함하고 있다고 할 수있다, 그래도 문제가 해결되지 않으면 전화가 올 부하 기능, 그것은

$(function() { 
    $('.lkupcode').hover(function() { 
    alert("This is working"); 
    }); 
}); 

을해야한다고 생각 신체; 그것이 <head>으로 옮겨지면 작동 할 것입니다.

+0

제안 해 주셔서 감사합니다. 그러나 작동시키지 못합니다. 나는 ** **에 jquery-ui를 가지고 있지만, 실제로 작동하는지 확인하기 위해 몸에 넣어 두었습니다. – user1288560

+0

부분적으로 코드를 넣으면 작동하지만 제대로 작동하지 않는 것 같습니다. 오 ... – user1288560

관련 문제