Skip to content

Commit

Permalink
merge in changes from other fork
Browse files Browse the repository at this point in the history
  • Loading branch information
parndt committed Mar 18, 2010
2 parents 3403b1d + 6160ca6 commit 65679e2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
8 changes: 6 additions & 2 deletions jquery.html5-placeholder-shim.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,11 @@
};
}
return this.each(function() {
if( $(this).data('placeholder') )
if( $(this).data('placeholder') ) {
var $ol = $(this).data('placeholder');
$ol.css(calcPositionCss($(this)));
return true;
}

var ol = $('<label />')
.text($(this).attr('placeholder'))
Expand All @@ -49,11 +52,12 @@
lineHeight: $(this).css('height')
})
.css(calcPositionCss(this))
.attr('for', this.id)
.data('target',$(this))
.click(function(){
$(this).data('target').focus()
})
.insertAfter(this);
.insertBefore(this);
$(this)
.data('placeholder',ol)
.focus(function(){
Expand Down
5 changes: 3 additions & 2 deletions test.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
zoom:1;
}
</style>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.js"></script>
<script src="jquery.html5-placeholder-shim.js"></script>
<!-- <script type='text/javascript' src='http://getfirebug.com/releases/lite/1.2/firebug-lite-compressed.js'></script> -->

Expand All @@ -66,13 +66,14 @@

<h2>Basic Examples</h2>
<a href="#" onclick="$('#cont').toggle();return false;">hide form</a>
<a href="#" onclick="$('#medium').toggle();$.placeholder.shim();return false;">hide medium row</a>
<div id="cont" >
<div>
<label>small</label>
<input type="text" placeholder="placeholder" class="small" />
<input type="text" placeholder="placeholder" value="value" class="small" />
</div>
<div>
<div id="medium">
<label>medium</label>
<input type="text" placeholder="placeholder" class="medium" />
<input type="text" placeholder="placeholder" value="value" class="medium" />
Expand Down

0 comments on commit 65679e2

Please sign in to comment.