0

This is a branch question from Typewriter Effect with jQuery

http://jsbin.com/araget/5

I'd like to sequentially inject and clear each string from the array into the 'placeholder' element on an html form. The function currently writes and clears each string into an empty span element.

No experience with jQuery :/, any tips on how to go about doing this?

Community
  • 1
  • 1
Kyle
  • 1,153
  • 5
  • 28
  • 56

1 Answers1

3

Use .attr()

$(element).attr('placeholder','Write text here'); 

to get value of placeholder attribute in jQuery

var placeholder_value = $(element).attr('placeholder'); 

Better use .prop()

$(element).prop('placeholder','Write text here'); 

to get value of placeholder attribute in jQuery

var placeholder_value = $(element).prop('placeholder'); 

Commented by Tats_innit

Read

Community
  • 1
  • 1
Tushar Gupta - curioustushar
  • 58,085
  • 24
  • 103
  • 107