0

http://jsfiddle.net/ZkAdt/8/

Take the URL: http://www.youtube.com/watch?v=B8c2G7RN0TM and paste it into the input field.

Observe the input field does not say "Thanks!" after pasting.

Check the logs. Observe that flashMessage fires, that self._input visually looks identical to that of the DOM element, but that the two are not the same.

Attempting to directly affect the DOM element does not work either.

What've I done horrible wrong?

1
  • 1
    It is the same element you have to compare with var result = this._input[0] == $('#songUrlInput')[0]; otherwise you only check that you have two different jQuery objects Commented Jun 9, 2012 at 19:57

1 Answer 1

1

The problem is rather simple. It's just not so simple to debug on jsFiddle. You are setting the placeholder with this line:

this._input.attr('placeholder', message).val('').blur();

Additionally you trigger blur which fires your other event handler that sets the placeholder back to the default text.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.