常用JQUERY操作まとめ
4586 ワード
【 】
<input type=
"checkbox"
id=
"checkbox_id01"
name=
"checkbox_id"
value =
" "
/>
<input type=
"checkbox"
id=
"checkbox_id02"
name=
"checkbox_id"
value =
" "
/>
1) checkbox
$(
'#checkbox_id'
).change(
function
() {
exe_function();
//
});
$(
'#checkbox_id'
).click(
function
() {
exe_function();
//
});
2) checkbox
$(
'input[name="checkbox_id"]:checked'
).each(
function
() {
if
($(
this
).val() ==
" "
) {
sother_price1 = 50;
}
if
($(
this
).val() ==
" "
) {
sother_price2 = 50;
}
});
【 】
$(
"input:radio[@name='radio_id']"
).change(
function
() {
//
}
【 】
1)
$(
'#input_id'
).blur(
function
() {
//
});
2) /
$(
'#input_id'
).val();
$(
'#input_id'
).val(
"xxx"
);
【 】
//
$(document).ready(
function
(){
$(
"#service_sml"
).append(
"<select style='width:100px' name='service_smlTB'><option> </option><option> </option><option> </option><option> </option></select>"
);
$(
"#service_big"
).change(
function
() {
var
values = $(
this
).val();
if
(values ==
" "
) {
$(
"#service_sml"
).empty();
$(
"#service_sml"
).append(
"<select style='width:100px'><option> </option><option> </option><option> </option><option> </option></select>"
);
}
if
(values ==
" "
) {
$(
"#service_sml"
).empty();
$(
"#service_sml"
).append(
"<select style='width:100px'><option> </option><option> </option><option> </option></select>"
);
}
});
});
// ,selectedIndex = 0
$(
'#option_id'
)[0].selectedIndex = 0;