Skip to content

Commit

Permalink
Added textarea placeholders.
Browse files Browse the repository at this point in the history
  • Loading branch information
zoltan-dulac committed Nov 18, 2011
1 parent 82c8f0c commit 5e7ee9c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
12 changes: 7 additions & 5 deletions shared/js/html5Widgets.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,15 @@ var html5Widgets = new function(){

function setPlaceholders() {

var nodes = document.getElementsByTagName('input')
var nodes = [document.getElementsByTagName('input'), document.getElementsByTagName('textarea')];

for (var i=0; i<nodes.length; i++) {
var node = nodes[i];

if (DOMHelpers.getAttributeValue(node, 'placeholder')) {
me.placeholderNodes.push(new PlaceholderInput(node));
for (var j=0; j<nodes[i].length; j++) {
var node = nodes[i][j];

if (DOMHelpers.getAttributeValue(node, 'placeholder')) {
me.placeholderNodes.push(new PlaceholderInput(node));
}
}
}
}
Expand Down
8 changes: 8 additions & 0 deletions tests/html5Widgets/placeholder.html
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,14 @@
</td>
</tr>

<tr>
<th>Notes :</th>
<td><textarea name="notes" placeholder="Please enter in some information to help us"></textarea>
<div class="description">If you are unemployed, please leave
blank.</div>
</td>
</tr>

<tr>
<th>Postal/Zip Code</th>
<td><input type="text" name="postalCode" value="" placeholder="Required information" required="required"
Expand Down

0 comments on commit 5e7ee9c

Please sign in to comment.