Skip to content

Instantly share code, notes, and snippets.

@juarezpaf
Forked from anonymous/gist:152027
Created July 23, 2009 03:03
Show Gist options
  • Save juarezpaf/152450 to your computer and use it in GitHub Desktop.
Save juarezpaf/152450 to your computer and use it in GitHub Desktop.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>::jquery::</title>
<link rel="stylesheet" href="jquery-ui-theme/ui.core.css" type="text/css" />
<link rel="stylesheet" href="jquery-ui-theme/ui.datepicker.css" type="text/css" />
<link rel="stylesheet" href="jquery-ui-theme/humanity/ui.theme.css" type="text/css" />
<style>
.ui-button:hover { border: 1px solid #444;cursor:pointer}
input { display:block;margin-top:5px}
</style>
</head>
<body>
<button class="ui-state-default ui-button ui-corner-all">Add Input</button>
<form>
<input type="text">
</form>
<script language="JavaScript" type="text/javascript" src="jquery/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="jquery/ui/jquery-ui.js"></script>
<script type="text/javascript" src="jquery/ui/i18n/ui.datepicker-pt-BR.js"></script>
<script>
$(function(){
var $form = $('form')
,dtPicker = function() {
$(this).datepicker({ showAnim: 'fadeIn',duration:'fast' });
};
$('button').bind('click',function(){
var ipt = document.createElement('input');
$(ipt).map(dtPicker);
$form.append(ipt);
})
$form.children().map(dtPicker);
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment