Is there have a way to copy placeholder attribute value as text to label

Like there but not need to repeat the text again?

 $("#your-name").attr("placeholder", "Your Name");  
  $('#test').html('Your name write second times?');




var pholder = $("#yourname").attr("placeholder");
$('#label'). text(pholder);

That gets the placeholder attribute from the HTML element with the ID yourname and sets it the text of the element with the ID label.

(Note that if you’re going to do this, then it should be the other way round, you should take the text from the label and use it for the placeholder: the label is an important thing, the placeholder is not)

1 Like