我在页面上有一个操作,用户点击该操作即可删除div。我想要实现的是,当点击发生时,自动更改下拉列表以显示值并刷新单独的div内容。
例如: -
$("a.removeTier").live('click', function() {
//var tier = $(this).attr('id').match(/\d+$/);
var tier = $(this).parent().parent().attr('id').match(/\d+$/);
//Set the drop down to the correct option value. On this action I'd like to mimic a onChange so the content of another div changes
$('#tiers').val(tier);
//Remove the parent div of the link clicked
$('#tier'+tier).remove();
});
答案 0 :(得分:1)
调用更改方法。
$("a.removeTier").live('click', function() {
//var tier = $(this).attr('id').match(/\d+$/);
var tier = $(this).parent().parent().attr('id').match(/\d+$/);
//Set the drop down to the correct option value. On this action I'd like to mimic a onChange so the content of another div changes
$('#tiers').val(tier);
$('#tiers').change();
//Remove the parent div of the link clicked
$('#tier'+tier).remove();
});