mercredi 29 juillet 2015

jQuery .val() doesn´t make a 'change'

I have problems testing my JavaScript. A part of my test looks like

$('#activityType').val("33");
$('#favorite').click();

The $('#activityType') is a select field and I want to select the option with value "33". Now I expected, that this would be a change, so that my function in my program like

$('body').on('change', '.item-select', function() {
    var itemRow = $(this).parent().parent();
    changeBookableItemInputFields(itemRow);
});

will be executed.

The $('#activityType') has got the class-attribute item-select, so I don´t understand, why $('#activityType').val("33"); is no change. I changed the value and the css-attribute is there. The body should be able to find it and the function should be executed.

Can anybody tell me, why it doesn´t work?

Aucun commentaire:

Enregistrer un commentaire