05-將input 變成div

05-將input 變成div

    httpsss://js.do/powenko/352363

    <script src="//ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
      First name: <input type="text" value="first " name="fname" />
      Last name: <input type="text"  value="Last "  name="lname" />
    
      <button>轉換</button>  
     
    <script>
    $("button").click(function(){
      $("p").slideToggle();
    
    	$(' input').replaceWith(function(){
                //console.log('type: ' + t_type+ '   name: ' + input.attr('name') + '   id: ' + input.attr('id') + '   Value: ' + t_val);
        	return '<span  id='+this.id+'  class='+this.className+'>'+this.value+'</span>'
        })
    });
    </script>