Ok i have a problem with selecting class with prefix name using variable. This is my code:
$('.product_type').on("click", function(event) {
type_id = event.target.id;
$("div[class*='product_']").fadeOut("fast");
var dbg = $("div[class*='product_']") + type_id;
dbg.fadeIn("fast");
$('#echo').text(show_ids);
});
Problem is at var dbg = $("div[class*='product_']") + type_id;
Selection is not working when I add variable + type_id...
type_idonto the class in the selector? Or...? It's often helpful if you post a minimal reproducible example demonstrating the problem, ideally a runnable one using Stack Snippets (the[<>]toolbar button; here's how to do one).type_idto a jQuery object. If you want to add it to the selector, add it to the string inside of$().var dbg = $("div[class*='product_']" + type_id);