Guest User

Untitled

a guest
Feb 17th, 2019
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. //Usando Jquery
  2. $("form input").each(function(){
  3. var id = $(this).attr('id');
  4. var attr = $("#" + id).attr("type");
  5. var ranS = Math.random().toString(36).substring(3);
  6. if(attr=="text" || attr=="password"){
  7. $(this).val(ranS);
  8. }else if (attr=="email") {
  9. $(this).val(ranS + "@ian.com");
  10. }else if (attr=="number") {
  11. $(this).val(Math.floor(Math.random() * (100000000 + 999999999)));
  12. }else if (attr=="checkbox") {
  13. $(this).attr("checked",true);
  14. }else{
  15. alert("Incluir el type: " + attr + " en la lista");
  16. }
  17. });
  18.  
  19. $("form select").each(function(){
  20. var id = $(this).attr('id');
  21. console.log(id);
  22. $(("#" + id)).append('<option selected value="1">Cristtian</option>');
  23. });
Add Comment
Please, Sign In to add comment