Answer the question
In order to leave comments, you need to log in
How to change parameters of elements generated with javascript?
I'm using the Bootstrap Form Helpers Languages plugin on my site, and the problem is that it generates almost the entire structure with JS, and there is no way to change or add anything (except for languages). The main problem is that it generates a list of languages with the a tag, but when you click on them, nothing happens. I tried adding href attributes to them:
$("ul[role='option'] > li > a[data-option='pl_PL']").prop("href", "/index.php?lang=pl_PL");
$("ul[role='option'] > li > a[data-option='en_US']").prop("href", "/index.php?lang=en_US");
Answer the question
In order to leave comments, you need to log in
I hope that I correctly understood the essence of the problem. Add this to the console and switch languages.
$('.bfh-selectbox-options div ul li a').on('click' , function (){
console.log($(this).attr('data-option')); // в зависимости от атрибута делаете , что нужно
});
I can imagine how long your selector works, can you imagine?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question