在JavaScript中使用El

Using El inside JavaScript

本文关键字:El JavaScript      更新时间:2023-09-26

如何在JavaScript中使用El标记??我不想在javascript函数中使用类作为标识符我想在Javascript中使用El表达式下面的代码运行良好,唯一的问题是我不了解如何使用El代替javascript中的id。请帮我

<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>
$("<c:out value="${yourVariable}"/>").keyup(function(){
    //do something
});