Previously, I utilized the following code to extract text from the data-placeholder attribute and apply it as a placeholder for my div.
[contentEditable=true]:empty:not(:focus):before {
content:attr(data-placeholder)
}
While this method worked well before, I am now facing a different scenario where the project is entirely jQuery-based. I am aware of jQuery functions such as .empty()
, .before()
, :not()
, and .focus()
. Can these be used together in the same way as CSS selectors when using jQuery?
var div = $([contentEditable=true]:empty:not(:focus):before);
If not, what would be a more efficient approach when dealing with multiple functions like this?