JavaScript

Firebase basic chating

Hello, long not post and now I’m back to post new article again. And now I’m ready to write article again. 😀
And again sorry for bad english, I’m from Indonesian and and my English grades at school are very ugly. But why do I still write in English? Because I want share this article not for Indonesian people, but for every one and I’ve you understand this article. Thank you. 🙂

Ok back to the topic, now I want share how to create basic chating (push chat and reply chat) using firebase. What is firebase? You can learn more at https://www.firebase.com. And now go to code…
First create File HTML and rename file to basic-chat.html:
(more…)

Javascript currency formatting

Hello now I am back again and now I want write how about to convert number to currency format. Maybe we know about javascript plugin to convert currency but it actually has a javascript function itself. Example I from Indonesia and I want currency number to “Rupiah”. If we want use javascript, you must read from this documentation https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/NumberFormat.
Example this is basic number formatting:

var number = 3500;

document.write(new Intl.NumberFormat().format(number));
// Result = 3,500

And this is if I using locales, example I use Indonesian:

var number = 123456.789;

// Indonesian uses comma as decimal separator and period for thousands
document.write(new Intl.NumberFormat('ID').format(number));
// Result = 123.456,789

And for more info list code locales, you can read from this http://userpage.chemie.fu-berlin.de/diverse/doc/ISO_3166.html
And now how if I want use currency code like ¥ or €

var number = 123456.789;

// the Japanese yen doesn't use a minor unit
document.write(new Intl.NumberFormat('ja-JP', { style: 'currency', currency: 'JPY' }).format(number));
// Result = ¥123,457

Form more info about style currency code, you can read from this http://www.currency-iso.org/en/home/tables/table-a1.html
For more info about date format you can read on this https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/NumberFormat

Jquery checking dynamic value from form input

Hallo.. Now I want share about create dynamic input value like my previous post https://imron02.wordpress.com/2014/02/10/jquery-dynamic-form-control/. But now the different from latest post is this post is create function for checking value from form input. Example I have dynamic form control like the above link, but I want to check all the input field, and ensuring that the last input must be greater than the previous inputs. Ok this is the code from me:
First we must create html file. Example I create with name checkInput.html:

<html>
<head>
    <title>Dynamic Checking Input Field</title>
    <script src='http://code.jquery.com/jquery-latest.min.js'></script>
</head>
<body>
<table id="content">
    <thead>
        <tr>
            <th>Name</th>
            <th>Value</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>Data</td>
            <td><input type="text" name="value" /></td>
        </tr>
    </tbody>
</table>
<button id="addField">Add Row</button>
<button id="submit">Submit</button>
</body>
</html>

(more…)

Jquery Dynamic Form Control

Previously I have discussed about dynamic form control on the following page https://imron02.wordpress.com/2013/08/16/jquery-button-add-field-from-input/. From latest page, I’ve made form control with dynamic add field, delete add field and move input field to up or bottom. But what is the difference of this tutorial?

The difference of this tutorial is now I will try to explain one by one of the jquery code. And I also make dynamic numbering.

For more detail, the first we must create example html file. So create example html like this:
(more…)

JQuery get value from checkbox

Ok now I will try to explain how to get value from checkbox checked. Example I create data like this checkbox.html:

<html>
<head>
	<title>Test Checkbox</title>
</head>
<body>
	<form>
		<input type="checkbox" name="test" value="2010" />2010
		<button name="check">Check</button>
	</form>
</body>
</html>

And this is example how to get value from checkbox using Jquery checkbox.html:
(more…)