Add html entity by name with jQuery prop() -
i'd add ellipsis input element's placeholder attribute jquery prop() instead of intended … literal string ….
how can add html entities name jquery prop()?
$(document).ready(function(){ $('div#b input').prop('placeholder','search…'); }); <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script> <div id="a"><input type="text" placeholder="search…" /></div><br /> <div id="b"><input type="text" /></div>
the simplest solution use raw hex code instead of named entity, these handled fine js , dom api.
$(document).ready(function(){ $('div#b input').prop('placeholder','search\u2026'); // <- \u2026 … }); <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script> <div id="a"><input type="text" placeholder="search…" /></div><br /> <div id="b"><input type="text" /></div>
Comments
Post a Comment