Font awesome icon font as a placeholder in input after adding class with jquery

左心房为你撑大大i 提交于 2019-12-04 14:23:16

You should parse the hash first. You can use $.parseHTML:

$('.wrapper input:first').attr("placeholder",$.parseHTML("")[0].data);

You can try something like this:

$('.wrapper input:first').attr("placeholder", $('<textarea />').html("&#61442;").html());

JSFiddle

This works by passing the value as HTML instead of text, which can be achieved by creating a reference to an element which doesn't really exist.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!