jquery how to determine event triggered with .trigger() or with .event()

Posted by Tony_M on Stack Overflow See other posts from Stack Overflow or by Tony_M
Published on 2011-06-28T05:47:02Z Indexed on 2011/06/28 8:22 UTC
Read the original article Hit count: 157

Filed under:
|

I have a selectbox.

<select  onchange="javascript:changePropertyDropdown('3','0','0','1',this.value,'80','50');  
hideCart()" size="1" class="inputbox" id="property_id_prd_3_0_1"  
name="property_id_prd_3_0_1[]">  
<option selected="selected" value="0">Select an option</option>  
<option value="1">38</option>
<option value="2">40</option>
<option value="3">42</option>
<option value="4">43</option>
</select>

and some button which triggered change event for selectbox :

$('div.attribute_wrapper select').bind('cascadeSelect',function(e, pAttr){
    $(this).val(pAttr);            
});

Call it like this (prodAttr come with ajax):

$('div.productImgGallery img').click(function(){
    $('div.attribute_wrapper select').trigger('change');
};
$('div.attribute_wrapper select').change(function(){
    $(this).trigger('cascadeSelect',prodAttr);
});

When i call it like this, hideCart() function fires too. I need to call function changePropertyDropdown() only whith .trigger(), and changePropertyDropdown() + hideCart() on change event. How can i do this ?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery