Add data fields and placeholder to form inputs

Davs Howard asked on July 23, 2015 16:02

I'd like to be able to add data fields and placeholder text to a forms layout/output.

Is this possible? I'm trying to achieve the following:

<input class="animated hideme" data-animated="fadeInLeft" data-animation-delay="100" type="text" name="name" placeholder="Name">
<input class="animated hideme" data-animated="fadeInLeft" data-animation-delay="300" type="text" name="jobtitle" placeholder="Job Title">
<input class="animated hideme" data-animated="fadeInLeft" data-animation-delay="500" type="text" name="company" placeholder="Company">
<input class="animated hideme" data-animated="fadeInLeft" data-animation-delay="700" type="email" name="email" placeholder="Email">
text<input class="animated hideme" data-animated="fadeInLeft" data-animation-delay="900" type="submit" name="submit">

Correct Answer

Davs Howard answered on August 3, 2015 17:23

Prefer a native solution if possible but have achieved this with jQuery as Roman suggested.

$('input[type="text"]').each(function() { 
    var $this = $(this); 
    $this.attr("placeholder", $this.attr("value")).removeAttr("value"); 
});
1 votesVote for this answer Unmark Correct answer

Recent Answers


Roman Hutnyk answered on July 24, 2015 03:43

David, I guess the easiest way to do that is to embed them with javascript/jquery

1 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.