2013-07-31 66 views
-1

如何在JavaScript中使用El標籤? 我不想使用類作爲JavaScript函數中的標識符 我想使用Java內部的El表達式 下面的代碼工作很好只有問題是我不懂如何在JavaScript中使用El代替 id。請幫幫我在JavaScript中使用El

<html> 

    <c:forEach items="${studentsList.students}" 
     var="student"> 

    <script type="text/javascript"> 
    $(document).ready(function(){ 
     $(here i want to use el value as id).keyup(function(){ 

    //do something 

     }); 

}); 
</script> 

</c:forEach> 


//Dynamic list of input boxes each having id of particular student 

<c:forEach items="${studentsList.students}" 
    var="student"> 
<input type="text" id="{student.id}"> 

</c:forEach> 


</html> 

回答

0
$("<c:out value="${yourVariable}"/>").keyup(function(){ 

    //do something 

});