Home >Web Front-end >JS Tutorial >jquery implements Weibo text input box and displays the number of words entered during input. Effect implementation_jquery

jquery implements Weibo text input box and displays the number of words entered during input. Effect implementation_jquery

WBOY
WBOYOriginal
2016-05-16 17:28:52987browse

效果如下:

jquery implements Weibo text input box and displays the number of words entered during input. Effect implementation_jquery

代码如下:

复制代码 代码如下:







<script><br>$(document).ready(function(){<br>  $(".taDetail").bind("click",showNum)<br>  .bind("keyup", showNum)<br>  .bind("blur", function(){$("#divShowNum").hide();});<br>});<br>var showNum = function(){<br> var d = $(this);<br> var pos = d.offset();<br> var t = pos.top   this.offsetHeight - 22; // 弹出框的下边位置<br> var l = pos.left  this.offsetWidth - 60;  // 弹出框的右边位置<br> var num = this.value.length;<br> $("#changeNum").html(num);<br> $("#divShowNum").css({ "top": t, "left": l }).show();<br>}<br></script>






/140



Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn