Javascript load more plugin6 min read

Javascript load more plugin

When searching the internet for a Javascript load more plugin, I came across a Jquery load more plugin tutorial in this youtube channel – Codecourse.

I highly recommend that the reader watch the Codecourse (formerly PHPacademy) tutorial and subscribe to their channel before continuing.

Link to the tutorial – Load More jQuery Plugin.

The tutorial was a really good and the plugin was very useful. But, with the aim of getting better at javascript and programming in general I tried to customize it.

So I decided to redo it in pure javascript. Here is how it went.

Demo link – Javascript load more plugin demo.

Please refer the above tutorial for creating a server side JSON API. The API would look like this Load more JSON API.

Now let’s get started with our plugin.

How to use?


  • elem: The main container.
  • source: JSON API page.
  • count: Number of results to load per request.


The plugin requires an HTML template to work with and the template would look like this.

Elements included are

  • #cont – Main Container.
  • .rescont – Container where results have to be loaded.
  • .items – Container for .item
  • .item – Individual data container which would be cloned with each result set.
  • [data-field] – The value of this attribute would be matched with the keys in the JSON object and corresponding values would be filled.
  • .nores – The element to be shown when there are no results. .rescont would be hidden and .nores would be shown if there are no results.
  • .load_more – Button which on click would load more results.


The plugin would take 3 inputs as given in the usage section.

It would have two main functions

  1. load – A function to load data from the JSON API page using ajax.
  2. append – A function to append the loaded data to the DOM.

The plugin


Now we have to set the necessary properties.

Getting load more button and saving it and it’s display property

Cloning .item element and removing it from the DOM.

The load function

The append function

Function to set value of any element

Initial loading

Also setting event listener on load more button to load data on click

And finally the plugin is complete ????.

Download link – lmore.js.

Leave your suggestions below.

My take on Reliance Jio4 min read

Reliance Jio

Reliance Jio offers unlimited free calls and 4G LTE data till December 2016. I have recently got the Jio sim card, of course to get free 4G internet ???? .


This Economic times article says Jio offers 17.34 Mbit/s down speed.

But I get about 4 – 7 Mbps download speed on average when in full range. Speed measured with

I was very happy about this until I searched the internet for 4G LTE speeds.

Data speeds of LTE (Theoretical)
Peak download 100 Mbit/s
Peak upload 50 Mbit/s

Stolen from –

OK there is nothing here to be unhappy about, everybody knows that’s not going to happen. But let’s look at the average speeds in other countries.

Average speeds of 4G in other countries – 
UK  16 – 25 Mbit/s
USA 9 – 16 Mbit/s

Stolen from –

Hmmm… ????

Maybe Opensignal results from india would also show similar results and the speed may vary in different parts of India.

So the question is am I happy with the speeds that I get?

A – I am, very much.

Why Jio calls are free?

The answer is they are not. Jio offers unlimited calls for a fixed charge and does not charge you by duration of the call like other providers.

For example if we look at their 149 plan, it offers 400 MB of 4G data and unlimited Local/STD calls for a period of 28 days from charging.

After 28 days if you do not recharge, the calls are no more free.

But when compared to other providers who charge separately and too much for data, calls and sms, the Jio offer looks pretty good.

How does Jio calls work?

Jio uses VoLTE standard for making calls. Unlike other providers Jio only has 4G LTE networks plus their wifi network as given in their website.

So calls pass through the LTE network following a protocol known as VoLTE (Voice over LTE). But other providers use 2G network with GSM protocol to make voice calls.

Essentially the voice is broken down and send as data packets.

Any LTE enabled phone can can make voice calls with Jio. But the phone must have the necessary software that supports the VoLTE protocol. Your phone may already have this or you can get it from doing an OS upgrade.

Jio provides the Jio voice app for phones that do not support VoLTE.

Does Reliance sent our personal data to ad networks?

Anonymous India Claims That Reliance Jio Is Sharing Call Data With Advertisers.

The above article says that Anonymous India, a hacker group claimed Jio apps are sending user call data to servers in US and Singapore and also to an ad network.

The group has also made more claims and Reliance has answered the concerns.

Anonymous post – Told truth with facts about Reliance Jio Chat app, targeted by Reliance Media Director.

Reliance reply – A statement by Reliance Jio Infocomm Ltd.

Any provider can view or sell user data unless it is encrypted at a higher level because it just passes through their gateways. But it would be illegal to do so without mentioning it in their terms and conditions.

 But the privacy policy in Jio website says

Improving your experience while using our services by presenting advertising, products and offers tailored to you;

And in the collection of information section it says

Usage logs/Server logs/Cookies which may contain details of your personal or sensitive personal information.

Conclusion : Hmmm… ????

Unlimited at night

No, Jio does not offer unlimited internet through out the night. It’s just from 2 am to 5 am.  We get unlimited internet for 3 hours a day, but at that part of the day when we least need it. Thank you Mr. Ambani ????.


And finally Jio offers its services at the cheapest rates India has ever seen. So what are you waiting for go get it, at least when everything is free. Prove your Indian-ness ???? .

Styling HTML forms 23 min read

Styling HTML forms 2

In a previous post we looked at styling HTML forms. In this one let’s try to take it further and mess around with it.

What are we going to do?

The aim is to add placeholder text to text inputs. If the element is not in focus we want to show only the placeholder text and hide the label text. But if in focus we want to hide the placeholder text and show the label text.

If that explanation didn’t work, here is a working example –

See the Pen Styling HTML forms 2 by hrishikesh mk (@avastava) on CodePen.0

We can add this effect with a few lines of extra javascript. The javascript in the  previous post looked like this –

It is to be noted that the desired effect works only with text inputs or elements that have the placeholder property. Ex – input[type=”text”],[type=”password”],[type=”number”], textarea element.

We have to create a collection of elements containing input elements ( excluding the types submit, checkbox and radio ) and textarea elements.

So let’s create a function which would help us identify the required elements. The function takes an element as input and tells us whether it is a required element or not.

Upgrading previous code

We need to add place holders for the input elements. So inside the for loop we add the following code

We take the label text and set it as the placeholder after checking if the element is of the required type. The label text is also hidden by setting the opacity property to zero. We are using the opacity property instead of display: none so that we can animate it using css transitions.

We used the input_fade function in the loop to change color of label text on focus. We have to slightly modify this function so that on focus the label text of the element becomes visible. But on blur if the value of the input field is empty we have to hide the label text and show the placeholder text instead.



Our aim was to create a beautiful form, but for this one to look good we need to add some more lines of code.

Styling placeholder text

The placeholder text should look the same as our label text.

Source – CSS Tricks

Adding a fading effect

Add this line of code to label text element and your beautiful form is ready. 🙂