G
G
garmon852019-01-11 09:51:01
JavaScript
garmon85, 2019-01-11 09:51:01

Bitrix core.js does not process a programmatically created event?

Good afternoon, I can't figure out why Bitrix core.js does not process the select change event.
The idea was this - after selecting the size of the product in the filter and going to the product card, automatically substitute the desired value in the select, through which the size is selected (sales offer), so that the price is automatically recalculated.
All the necessary parameters are received, select selects the desired option, but the price is not recalculated.
Here is how I tried to implement it

$(document).ready(function(){   					
var dropdown = $(".select_sku"); 
$("option", dropdown).each(function(){
var data_val = $(this).attr("data-onevalue"); 
if(data_val  == $(".filter_id").text()	) {		
var f_val =	$(this).val();	
$(".select_sku").val(f_val).trigger("change");
}	
});					
});

5c383c93a28bd890802705.jpeg
I would be very grateful for any hint.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey delphinpro, 2019-01-11
@garmon85

.trigger("change");

This is jquery.
Raise a native event.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question