Retrieve index of HTML element within parent
I only use ternary operator with simple expressions. 

Try to put them in independent methods. Otherwise, use the simple and boring (but expressive) if statement.