使用加载函数加载页面时,jquery keyup函数不起作用

时间:2018-05-23 10:27:26

标签: javascript jquery html jsp

我有一个jsp页面说a.jsp,我有一个选择框,在更改选择框时我正在加载另一个jsp页面,例如b.jsp。我将b.jsp页面加载到一个id为' q_bank_criteria'的div。在a.jsp中,我有类assmt_count的键加功能,如下所示,这是行不通的,但是当我直接包含b.jsp的内容时,它有效。可能是什么问题?

$('#assmt_count').keyup(function() {
 alert("hi");
});

- a.jsp -

$('select[name=final_assessment_id]').change(function () {
   $('#q_bank_criteria').load('b.jsp.jsp?assessment_id=' + assessment_id, function() {

   });
});

- b.jsp -

<div>                            
    <label>Select questions from assessment</label>
    <table class="table table-hover table-bordered">
        <thead>
            <tr>
                <th id="th1">Complexity type</th>
                <th id="th2">Total Questions</th>
                <th id="th4">Enter no's to display</th>
            </tr>
        </thead>
        <tbody>
            <%
                String assessment_id = request.getParameter("assessment_id").trim();
                String sqla1 = "SELECT c.complexity_type_id,c.complexity_type_name, COUNT( qb.question_id ) as cnt "
                        + "FROM assessment_qp AS aqp, question_bank AS qb, complexity_type AS c "
                        + "WHERE assessment_id ='"+assessment_id+"' "
                        + "AND aqp.question_id = qb.question_id "
                        + "AND qb.complexity_type_id = c.complexity_type_id "
                        + "GROUP BY c.complexity_type_id";
                Statement st2a1 = connection.createStatement();
                ResultSet resultSet1a1 = st2a1.executeQuery(sqla1);
                while (resultSet1a1.next()) {
            %>
            <tr>
                <td><%=resultSet1a1.getString("complexity_type_name")%></td>
                <td><%=resultSet1a1.getString("cnt")%></td>
                <td><input type='number' class='assmt_count' id='assmt_count' min="0" max="<%=resultSet1a1.getString("cnt")%>" name="cnt<%=resultSet1a1.getString("complexity_type_id")%>" disabled/></td>
            </tr>
            <%
                }
            %>
            <tr>
                <td></td>
                <td>Total Questions</td>
                <td id='total_count'></td>
            </tr>
        </tbody>
    </table>
</div>

0 个答案:

没有答案