V
V
Vasily2016-10-22 18:59:48
JavaScript
Vasily, 2016-10-22 18:59:48

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");

Also tried .trigger() and click().
In firebug, you can see that they have been added, but nothing happens. I looked through the entire plugin code, but did not find anything that can block their robot.
Website address: vasyldemianiuk.com (a little under-smoked, problems with ssl, but on localhost the same problem).
All website code: https://github.com/WELES777/PORTFOLIO.git

Answer the question

In order to leave comments, you need to log in

2 answer(s)
C
coderisimo, 2016-10-22
Demyanuk @WELES333

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')); // в зависимости от атрибута делаете , что нужно
});

D
Dzhakhar Ukhaev, 2016-10-22
@dzhakhar1209

I can imagine how long your selector works, can you imagine?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question