Skip to content

Commit

Permalink
Use textarea's placeholder attribute of prompt is not provided in opt…
Browse files Browse the repository at this point in the history
…ions. Fixes issues #8.
  • Loading branch information
cmer authored and alexgorbatchev committed Feb 19, 2012
1 parent 163da25 commit 514d03e
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/js/textext.plugin.prompt.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@
p.init = function(core)
{
var self = this,
container
container,
prompt
;

self.baseInit(core, DEFAULT_OPTS);
Expand All @@ -121,6 +122,14 @@
self.core().wrapElement().append(container);
self.setPrompt(self.opts(OPT_PROMPT));

prompt = self.opts(OPT_PROMPT);

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

if(prompt)
self.setPrompt(prompt);

if($.trim(self.val()).length > 0)
self.hidePrompt();

Expand Down Expand Up @@ -227,7 +236,7 @@
input = self.input()
;

if($.trim(self.val()).length === 0 && !input.is(":focus"))
if($.trim(self.val()).length === 0 && !input.is(':focus'))
self.containerElement().removeClass(CSS_HIDE_PROMPT);
};

Expand Down

0 comments on commit 514d03e

Please sign in to comment.