Using an apostrophe in an input field

Hi there,

I am trying to use an apotrophe in an input fields with this code, but it isn’t working. Is there a way I can use apostrophes in the below. I am referring to the values of “your friend’s name”.


onblur="if (this.value == '') {this.value = 'your friend's name';}"
onfocus="if(this.value == 'your friend's name') {this.value = '';}" value="your friend's name"

Instead of trying to match the value against the exact value you need match against what you can do is use a property like is kind of how to find if your still newish to JavaScript which is defaultValue, basically this property stores the initial value of the input field allowing you to match it again something else.

See the below:

<input onblur="if (!this.value.length) this.value = this.defaultValue;" onfocus="if (this.value === this.defaultValue) this.value = '';" value="your friend's name" />