I'm trying to place a button next to the text that the user has selected like this:
But I want to place it only if the selection is on text that is inside divs with class floatbtnable
. For example:
<div class='foo'><!--The floating button doesn't show up if user selects text that is in here --></div>
<div class='floatbtnable'><!--If the user selects text that is in here, the floating button shows up next to user selection. --></div>
NOTE: I've figured out how to place a button next to the user selection, I just want to add a filter such that the button shows up only for a particular class of selected text and not all the time.