For those, who failed to spot it before, hoisted here:
NO JS frameworks please. Even little ones.
And let me add: no libraries as well, for those who want to propose jQuery saying it's a library, not a framework. :P
I have list items with icons, via:
li:after {
content: " : " url(ncheck.png) url(ntrash.png);
}
Question: upon clicking the icons I want to run JS code (different for trash and check). How to do so with pure CSS / native JS?
Intent: I'm wondering whether content inserted via ::after
can be made actionable.
I'm working on making this happen via img
tags (image button technique), however wanted to know, whether I missed something, and whether this can be done using CSS ::after
.
PS. Browser support: FF is a must, Chrome is a nicety.
Updated - why that content should NOT be actionable
In the end I decided against using ::after
for actionable content. Reasons:
- CSS for actionable content is meh
- Content added with
::after
is added AFTER element, but before next element. So, addingspan
and makingspan
actionable requires further tweaking and arm-twisting in order to move the span from it's actual position. Too weird, too hacky to really be worthwhile. - There's absolutely lovely piece of why neither DIVs nor SPANs are BUTTONs.
So, I went with adding input type="image"
instead.
Thanks to TJCrowder and Harry for their time and help here.