Your attribute values arent quoted, so they end in space. Hashes are half the battle:
$('.ed_name').replaceWith(function () {
return '<input placeholder="'+$(this).text()+'" value="'+$(this).html()+'" class="ed_inp">'
});
but the correct way is to create an element, not HTML:
$('.ed_name').replaceWith(function () {
return $('<input />', {
placeholder: $(this).text(),
value: $(this).html(),
class: 'ed_inp',
});
});
source
share