2016-01-27 43 views
1

我試圖做出如下:如何使隱藏/顯示按鈕出現在一個輸入而不引導

enter image description here

我的網頁目前看起來是這樣的: enter image description here

我該怎麼辦放置隱藏/顯示並在輸入字段內生成鏈接。沒有使用引導,任何幫助將不勝感激。下面

代碼:

<script type="text/javascript" > 
 
        var pwdwidget = new PasswordWidget('thepwddiv','pass1'); 
 
        pwdwidget.MakePWDWidget(); 
 
       </script> 
 
       <noscript> 
 
       <div> <input type="password" id="pass1" name="password" value="" placeholder="Password" required <?php $reg_errors ?>/></div> 
 
       </noscript>
.container{ 
 
    padding: 0 auto; 
 
    width: 450px; 
 
    margin: 180px 35% 0% 35%; 
 
} 
 

 
input[type=email]{ 
 
    font-family: AmsiPro-XLight; 
 
    background-color:#FFF; 
 
    /* border: 1px dotted #999;*/ 
 
    float: right; 
 
    /* margin: 2em 35% 0% 35%;*/ 
 
    padding: 18px 20px; 
 
    width: 400px; 
 
    /* background-clip: padding-box;*/ 
 
    border: 1px solid #FFF; 
 
    border-bottom-color: #FFF; 
 
    border-radius: 5px; 
 

 
} 
 

 
input[type=password]{ 
 
    font-family: AmsiPro-XLight; 
 
    background-color:#FFF; 
 
    /* border: 1px dotted #999;*/ 
 
    float:right; 
 
    /* margin: 10px 35% 0% 35%;*/ 
 
    padding: 18px 20px; 
 
    width: 400px; 
 
    /* background-clip: padding-box;*/ 
 
    border: 1px solid #FFF; 
 
    border-bottom-color: #FFF; 
 
    border-radius: 5px; 
 

 
} 
 

 
input[type=submit]{ 
 
    font-family: AmsiProNarw-Regular; 
 
    text-align: center; 
 
    background-color:#d5e16d; 
 
    float: right; 
 
    margin: 10px 0% 0% 5%; 
 
    padding: 18px 20px; 
 
    width: 100px; 
 
    height: 50px; 
 
    /* background-clip: padding-box;*/ 
 
    border: 2px solid #a5a953; 
 
    /* border-bottom-color: #142647;*/ 
 
    border-radius: 8px; 
 

 
} 
 

 
/* Show button */ 
 

 
input[type=button]{ 
 
    font-family: AmsiProNarw-Regular; 
 
    /* text-align: center;*/ 
 
    /* background-color:#FFF;*/ 
 
    float: right; 
 
    /* margin: 10px 0% 0% 5%; 
 
     padding: 18px 20px; 
 
     width: 50px; 
 
     height: 50px; 
 
      background-clip: padding-box; 
 
     border: 2px solid #a5a953; 
 
     border-bottom-color: #142647; 
 
     border-radius: 8px;*/ 
 
    /*  content:"\e105";*/ 
 
    font-family: 'Glyphicons Halflings'; 
 
    content:"\e105"; 
 
} 
 

 
title { 
 
    display: none; 
 
} 
 

 
/*.pwdwidgetdiv 
 
{ 
 
\t width:155px; 
 
} 
 
.pwdfield 
 
{ 
 
\t width:150px; 
 
} 
 
*/.pwdopsdiv{ 
 
\t display: block; 
 
\t float: left; 
 
\t margin-left:2%; 
 
     color: #000;  
 
} 
 

 
.pwdopsdiv a 
 
{ 
 
\t font-family : AmsiProNarw-Regular;; 
 
\t font-size : 1em; 
 
     text-decoration: none; 
 
} 
 

 
/*Hide/Show password meter*/ 
 
.pwdstrengthbar{ 
 
    float:right; 
 
    background:#e86065; 
 
    height:10px; 
 
    margin-top:-10px; 
 
} 
 

 
.pwdstrength{ 
 
    float:right; 
 
    height:20px; 
 
    width:300px; 
 
    margin-top:15px; 
 
} 
 

 
/*Password strength meter text*/ 
 
.pwdstrengthstr{ 
 
    float:right; 
 
    clear:both; 
 
    height:14px; 
 
    margin-top:-20px; 
 
    font-family : AmsiProNarw-Regular; 
 
    font-size : 0.8em; 
 
}
<section class="container"> 
 
      <form class="Form" method="post" action="reg_1.php" accept-charset="utf-8"> 
 

 
       <!--     <div id="first">--> 
 
       <input type="email" id="email" name="email" placeholder="Email Address" value=''> 
 
       <br> 
 
       <!-- Hide/Show generate password --> 
 

 
       <div class='pwdwidgetdiv' id='thepwddiv'></div> 
 
       <input type="password" id="pass2" name="password2" value="" placeholder=" Confirm password" required <?php $reg_errors ?> 
 

 
         <p class="remember_me"> 
 
       </p> 
 
       <p class="submit"><input type="submit" name="submit" value="Register"></p> 
 
       <br> 
 
       </form> 
 
     </section>

+0

從來沒有得到你的答案? – Riskbreaker

+0

我沒有大聲笑。但我自己工作了 – jerneva

回答

0

點擊更改文本?只要做的if/else與文本:

$('.showhide').click(function (e) { 
    e.preventDefault(); 
     $('.show').text(function (i, v) { 
      return $this.is(':hidden') ? 'HIDE' : 'SHOW' 
     }) 
    }); 
}); 

如果要定義並添加一個按鈕或只是文字你可以擁有它這樣(複雜):

SHOW PASSWORD

+0

謝謝。我現在就試試這個。如果密碼是強或弱的,就是這樣編碼的 – jerneva