views:

86

answers:

1

Hi,

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();                   
});
+1  A: 

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();                   
});
mathieu
I'm not sure where this would fit in....
I call .change() when the user selects an option for the drop down. But, in the second scenario I'm setting the value of the drop down with jQuery, this is where I'd like to simulate the change so my content can change.
I can't seem to get the .change() to work with IE