我試圖做一個相當直接的模糊選擇一個特定的字段框。我不確定爲什麼(對於我的例子),我不能簡單地讓框改變模糊動作的背景顏色。問題與Rails,haml +模糊字段對象上的JavaScript
這裏是我的代碼:
在HAML HTML
:javascript
$("person_email").blur(function(){
$("person_email").css("background-color","#D6D6FF");
});
<input id="person_email" name="person[email]" size="30" type="text" class="MB_focusable">
在HTML
<script>
//<![CDATA[
$("person_email").blur(function(){
$("person_email").css("background-color","#D6D6FF");
});
//]]>
</script>