jQuery_review之textarea的放大和縮小的jQuery實現,jquerytextarea

來源:互聯網
上載者:User

jQuery_review之textarea的放大和縮小的jQuery實現,jquerytextarea

    眾所周知,各種瀏覽器對於HTML、CSS以及原生JS的支援不盡相同。但是jQuery很好地封裝了各種瀏覽器不同的實現,能夠很好地解決跨瀏覽器的CSS問題。下面就是在review表單操作的時候的一個DEMO,記錄在這個地方,方便後面做項目的時候尋找使用,這個如果添加動畫效果會更好,jQuery所有的動畫效果都是可以通過animate函數來實現。

<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html>  <head>  <script type="text/javascript" src="jquery-1.8.3.js"></script>  <script type="text/javascript">      $(function(){            $("input[type!='button'],textarea").focus(function(){              $(this).addClass("onfocus");          }).blur(function(){              $(this).removeClass("onfocus");          });                    $(".opeTextArea").toggle(function(){              $(this).text("max");              $("textarea").width(400).height(120);          },function(){              $(this).text("min");              $("textarea").width(200).height(60);          });      });  </script>  <style type="text/css">      .onfocus{          border:solid red 2px;          background-color:grey;          }      textarea{          width:200px;          height:60px;      }      .resumeContainer{          width:200px;      }      .opeTextArea{          color:white;          background-color:black;          margin:2px;          padding: 2px 6px;      }  </style>  </head>  <body>      <form action="#" method="get">          <label for="name">name:</label>              <input type="text" name="name"><br/>          <label for="password">password:</label>              <input type="password" name="password"><br/>          <label for="qq">QQ:</label>              <input type="text" name="qq"><br/>          <label for="resume">resume:</label>          <div class="resumeContainer">              <span class="opeTextArea">min</span>                  <textarea rows="3" cols="10"></textarea>          </div>          <input type="button" value="submit"><br/>      </form>  </body></html>




JQUERY操作textarea的問題

$("#textAreaId").css(""font"……");

修改後:textarea元素有點特殊,它的內容是包在開始和結尾標籤之間的。所以你嘗試:
$("#textAreaId").html("");
 
助:IE中實現可縮放的div(帶TextArea)

去jquery官網,找jquery UI,其中有一個resizable的外掛程式,你下載這個外掛程式的demo,其中專門有一個textarea.html就是針對textarea滑鼠拖動縮放的,應該可以解決你的問題。
 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.