I have an action on a page whereby a user clicks to remove a div. What I'd like to achieve is, when the click occurs, automatically change a drop down to show a value and refresh a separate div content.
For example:-
$("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();
});
Call the change method.
$("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();
});
精彩评论