我有这个表格,当我打开记事本时,有我的链接列表, 我从记事本中复制它然后粘贴textarea中的所有链接然后它应该计数。
但我试图解决的是,当我复制并粘贴时,它会在我进入时自动计算。
我的代码如下,以解释我的作品。
jQuery代码
jQuery.fn.wordCount = function(params) {
var p = { counterElement:"display_count" };
var total_words;
if(params) {
jQuery.extend(p, params);
}
//for each keypress function on text areas
this.keypress(function() {
total_words=this.value.split("\n").length;
jQuery('#'+p.counterElement).html(total_words);
});
};
$(document).ready(function(){
$('#txtLinks').wordCount();
});
我的表格
<form method="post">
<textarea name="texturl" rows="10" cols="20" id="txtLinks" class="textarea-addlinks"></textarea>
</form>
,链接
http://09-flex-actionscript-it.gnstudio.com/index.php?title=Are_aware_of_the_Uncomplicated_strategies_to_post_sms_to_help_all_people
http://09-flex-actionscript-it.gnstudio.com/index.php?title=Below_To_acquire_pizza_hut_vouchers
http://09-flex-actionscript-it.gnstudio.com/index.php?title=Brand-new_business_model_innovation_specialists
http://09-flex-actionscript-it.gnstudio.com/index.php?title=Ery_at_times_a_good_Pizza_Express_Voucher_Are_usually_for_exciting
http://09-flex-actionscript-it.gnstudio.com/index.php?title=Gain_knowledge_of_on_the_subject_of_signs_of_depression
http://09-flex-actionscript-it.gnstudio.com/index.php?title=Get_yourself_a_dvd_swimming_pool_covers_currently
http://09-flex-actionscript-it.gnstudio.com/index.php?title=Simple_and_standard_symptoms_of_the_flu
http://09-flex-actionscript-it.gnstudio.com/index.php?title=Speaking_about_the_necessities_regarding_tinnitus_miracle:
http://09-flex-actionscript-it.gnstudio.com/index.php?title=The_best_places_to_secure_cheap_supplements_web_based
计数值应为9。 有没有办法没有必要按Enter键我的意思是它会自动计算链接?顺便说一下 - 它有多重要?它算新的链接。
谢谢你们