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&hellip;" /></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 &hellip;  });
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script>    <div id="a"><input type="text" placeholder="search&hellip;" /></div><br />  <div id="b"><input type="text" /></div>


Comments

Popular posts from this blog

javascript - Bootstrap Popover: iOS Safari strange behaviour -

Website Login Issue developed in magento -

Can the constants be defined inside a model file of a framework in PHP? -