Tuesday, August 22, 2017

Menghitung Kata dengan jQuery - jQuery Words Counter



Langsung saja jika ingin mencobanya. Buat file index.html :

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Menghitung Kata dengan jQuery</title>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="jquery.wordcount.js"></script>
<script type="text/javascript">
<!--//---------------------------------+
//  Developed by Roshan Bhattarai 
//  Visit http://roshanbh.com.np for this script and more.
//  This notice MUST stay intact for legal use
// --------------------------------->
$(document).ready(function()
{
$('#word_count').wordCount();
//alternatively you can use the below method to display count in element with id word_counter  
//$('#word_count').wordCount({counterElement:"word_counter"});
});
</script>
<style type="text/css">
body {
font: 12px Verdana,Arial, Helvetica, sans-serif;
margin: 10px auto;
width:350px;
}
</style>
</head>
<body>
<h2>Menghitung Kata dengan jQuery</h2>
<div id="container">
  <div>
    <p><br />
      <textarea name="word_count" id="word_count" cols="30" rows="6"></textarea>
    </p>
    <p>    <span style="color:#FF0000">Total kata : <span id="display_count">0</span></span>
        </p>
  </div>
</div> 
</body>
</html>

Lalu Copy 2 file jQuery yang bisa kalian download di SINI (password : ramionism)

Setelah itu, 3 file tersebut harus ada dalam 1 folder. Dan jalankan file html di browser.

Ini juga saya belajar-belajar. Sengaja taro di blog biar ingat kalau suatu saat butuh. Saya pun belajar dan cari tutorial dari luar juga. Dan saya catat di sini. Mohon tambahannya jika ada kekurangan.

Instagram : @ramadhanafas
Twitter : @ramadhanafas