728x90
반응형
$("#btn").trigger("click");
$("# btn").click(function(e){}).trigger("click");
#
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8" trimDirectiveWhitespaces="true"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>ready onchange준비하기</title>
</head>
<body>
<table>
<tr>
<td>
<select class="base" name="searchTestMajorCd" id="onChange_searchTestMajorCd">
<option value="">전공필수여부</option>
<c:forEach var="comTestMajorCd" items="${comTestMajorCd}">
<option value="${comTestMajorCd.code}" <c:if test="${comTestMajorCd.code eq dataMap.searchTestMajorCd}">selected</c:if>>${comTestMajorCd.codeName}</option>
</c:forEach>
</select>
<span id="ajaxSelectComTestMajorCdResult" data-searchLongMajorSeq="${dataMap.searchLongMajorSeq}">
<select class="base">
<option value="" <c:if test="${empty dataMap.comTestMajorCd}">selected</c:if>>전공</option>
</select>
</span>
</td>
</tr>
</table>
<script type="text/javascript">
//<![CDATA[
$(document).ready(function() {
$(document)
.on("change", "#onChange_searchTestMajorCd", function(e) {
var actUrl = "<c:url value='/test/ajaxSelectComTestMajorCd.do'/>";
$.ajax({
type:"POST"
,url:actUrl
,data:$("#frm").serialize()
,dataType:"html"
,async:false
,cache:false
,success:function(data, textStatus, req) {
var comtestMajorCd = data;
$('#ajaxSelectComTestMajorCdResult').html(comtestMajorCd);
},
error : function(xhr, status, error) {
alert("status ==" + status + "error ==" + error);
}
});
});
fnReadySet();
});
function fnReadySet() {
var rdSearchtestMajorCd = $('#onChange_searchTestMajorCd option:selected').val();
$('#onChange_searchTestMajorCd').change(function(e){}).trigger('change');
var longMajorSeq = "${result.longMajorSeq}"; $("#onChange_searchTestMajorCd").val(longMajorSeq).prop("selected", true); }
//]]>
</script>
</body>
</html>
|
cs |
#
728x90
반응형