Skip to content

Commit

Permalink
Cleaned up prompt plugin reading placeholder attribute.
Browse files Browse the repository at this point in the history
  • Loading branch information
alexgorbatchev committed Feb 19, 2012
2 parents 514d03e + 1786e49 commit 537f38b
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/js/textext.plugin.prompt.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@
*/
p.init = function(core)
{
var self = this,
var self = this,
placeholderKey = 'placeholder',
container,
prompt
;
Expand All @@ -122,10 +123,13 @@
self.core().wrapElement().append(container);
self.setPrompt(self.opts(OPT_PROMPT));

prompt = self.opts(OPT_PROMPT);
prompt = core.input().attr(placeholderKey);

if(!prompt)
prompt = core.input().attr('placeholder');
prompt = self.opts(OPT_PROMPT);

// clear placeholder attribute if set
core.input().attr(placeholderKey, '');

if(prompt)
self.setPrompt(prompt);
Expand Down

0 comments on commit 537f38b

Please sign in to comment.