html - Show placeholder text as label in Desktop -


this question has answer here:

i want show placeholder in mobile view , hide placeholder in desktop view. how this?

end inand mobile view should this:

<label>enter name:</label>  <input type="text"/>

and mobile view should this:

<input type="text" placeholder="name">

with jquery :

$(document).ready(function(){      $(window).resize(function(){          var wid = $(this).width();          if((wid > 300) && (wid < 400)) {              $('input[type="text"]').attr('placeholder','name');              $('label').hide();          }          else {              $('input[type="text"]').attr('placeholder','');              $('label').show();          }      })  })
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>    <label>enter name:</label>  <input class="int" type="text"/>


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -