SOCIALIZE IT

Thursday 21 November 2013

Placeholder IE using jquery for html5

<style>
 .placeholder { color:#999; }
</style>

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js">
</script>
<script>
 // A jQuery based placeholder polyfill
$(document).ready(function(){
  function add() {
    if($(this).val() === ''){
      $(this).val($(this).attr('placeholder')).addClass('placeholder');
    }
  }

  function remove() {
    if($(this).val() === $(this).attr('placeholder')){
      $(this).val('').removeClass('placeholder');
    }
  }

  // Create a dummy element for feature detection
  if (!('placeholder' in $('<input>')[0])) {

    // Select the elements that have a placeholder attribute
    $('input[placeholder], textarea[placeholder]').blur(add).focus(remove).each(add);

    // Remove the placeholder text before the form is submitted
    $('form').submit(function(){
      $(this).find('input[placeholder], textarea[placeholder]').each(remove);
    });
  }
});

</script>
</head>
<body>
 <input type='text' name='email' placeholder='Email Address'/>
 <input type='password' name='password' placeholder='Password'/>
</div>

Tuesday 19 November 2013

Add ( DIV ) js

<script type="text/javascript">
$(window).load(function(){
    var i=0;   
    $("#uniform-account_type > span").each(function(){
        $(this).append("<div class='blk'></div>");
        i++;
    })
});
</script>