I try using SELECTRIC to select the current (selected) element Li, but nothing happens, tell me who knows how it can be done
There is one snag, I use not SELECT and OPTION, and UL and LI:
EXAMPLE SELECTRIC and UL, what am I doing here
Here is the link to the Selectric http://lcdsantos.github.io/jquery-selectric/ index.html
Answer 1, Authority 100%
Found a roughly similar solution, here HTML:
& lt; ul class = "customoptions" & gt;
& lt; li class = "" & gt; Select Something & lt; / li & gt;
& lt; li class = "" & gt; & lt; span data-value = "value1" & gt; Choice 1 & lt; / span & gt; & lt; / li & gt;
& lt; li class = "selected" & gt; & lt; span data-value = "value2" & gt; Choice 2 & lt; / span & gt; & lt; / li & gt;
& lt; li class = "" & gt; & lt; span data-value = "value2" & gt; Choice 3 & lt; / span & gt; & lt; / li & gt;
& lt; / ul & gt;
JS will look like this:
$ (function () {
$ ('. CustomOptions'). SELECTRIC ({
MaxHeight: 300,
ONCHANGE: FUNCTION (ELEMENT) {
Alert ($ ("SelectricItems'). Find ('. Selected Span'). Attr ('Data-Value'));
}
});
});
Link to Source: https://stackoverflow.com Questions / 25137198 / Magento-JavaScript-undefined-is-not-a-function-jQuery-Selectric