Author: <span class="vcard">Yogesh Singh</span>

Password field by default doesn’t show any visible text other than the symbol.

Some websites allow the user to view the hidden text in password field by toggling.

For this, they provide an element e.g. checkbox or a button when it gets clicked then the password element value is been visible on the screen and reset to default view when it again gets clicked.

In this article, I show How you can implement this functionality with jQuery and JavaScript.

show and hide Password field text with jQuery and JavaScript

Javascript Jquery

You cannot control when user will refresh the web page and close it, but it’s important sometimes to display confirmation alert before closing the Tab.

The user may be mistaken clicked the close button and lost some important data.

You have seen in Shopping websites when you are in the middle of payment or you are paying the Bill and if you try to refresh the web page then it will show a confirm alert on the screen.

When is it Required?

  • When the form has many fields and the user filled the form but somehow the Browser is being closed. Now, the user needs to again fill that long form.
  • While student giving the online test and not completed yet and try to close or refresh the page.
  • There are many other situations where you can use it.

In this post, I discuss How you can detect Browser Tab close and refresh using JavaScript.

How to know a browser tab close or refresh with JavaScript

Javascript

The images which are wouldn’t successfully load on the web page will show nothing when the source does not exist.

It looks bad when there are many images and some of them are missing.

For solving this you need to look through all the pages and find the broken images and fix them manually time to time. It is the time-consuming process.

In this tutorial, I will show you with two examples, to automatically detect the broken images and replace with another image.

  • In the first one, I am using the jQuery, and
  • In the second, using AJAX with jQuery

How to check Broken Image with jQuery and AJAX

 

AJAX Jquery

There are many cases when require to update certain part of the web page on the regular basis.

For example – showing live cricket or football score, display latest news feeds,etc.

There are two ways to send AJAX request on specified time –

  • By setInterval() and
  • By setTimeout() JavaScript functions.

Both do the same work but they are reliable for certain cases, which I discuss in this tutorial.

How to fire AJAX Request on Regular Interval

AJAX Jquery PHP

Alert is one of the most used functions in the JavaScript. By this, we interact with users by showing information on the screen.

For example, use it in form validation for showing the warning on invalid input or using it to display the alert message when form successfully submitted. There are many other cases when you can use this.

But, the problem is it does not look good on the screen.

There are many free jQuery plugins that you can use to show the user-friendly message box.

In this tutorial, I introduce you with a sweetAlert jQuery plugin by which you can show custom message box on the screen and use it as an alternative to default alert box.

Jquery

You generally display an error message while validating the form by using the alert or place message on <div> or <span> elements and show or hide them.

If you have a form which has many elements and you need to add Client-side Validation.

You are using the container to show the error messages in this case you need to create several container elements. It is a time-consuming process.

For making your validation process simpler there are many free jQuery plugins.

In this tutorial, I will explain you about Validation jQuery Plugin, using that you can define validation faster and systematic way.

It has the built-in method which you can use for validation and you can change the text of default error message.

You can also create your own method if you do not find any built-in method according to your requirement.

Add validation to the form with jQuery Validation Plugin

Jquery

In this quick tutorial, I show How you can disable Right-click and keyboard shortcut of cut,copy, and paste from the whole document or in a particular element using jQuery.

You can find this type of functionality mainly in Test based web application where student not allowed to copy and paste content on the page.

When it’s required?

There are many cases where you can use it.

For example – You want to change the behavior of Right click and show your own context menu or For stopping the user to copy your page contents.

Jquery

Whether you are a beginner or not to the WordPress, you have seen the shake effect when you go for the Login in Admin Dashboard.

The login box shakes every time when the user enters the wrong username and password.

In this tutorial, I show How you can create the similar kind of effect using jQuery UI.

What in the demonstration?

For demonstration, I am creating two examples – In first, I am creating a basic Login form which shakes on the wrong username and password and in the second example, using the arguments with shake effect.

How to shake an element using jQuery UI

Jquery

Recent post-Widget list your latest post and it helps you to keep reader longer in your site which reduces the bounce rate.

You can add it to anywhere within your site.

But, What if you want to show the thumbnail in the Widget?

WordPress by default doesn’t show thumbnail in Recent posts Widget and if you want to add it you need to either modify the code or use Plugins.

Using plugins you can set your post featured image as the thumbnail or show any default image if there is no featured image and you can adjust its size.

In this article, I show you –

  • How you can add Recent Post Widget in the sidebar of the WordPress, if you know it you can skip to Show thumbnail using Plugins section.
  • And, add the thumbnail using Plugins.

easily-add-thumbnail-to-the-recent-posts-wordpress-1

How To

The phpMyAdmin allows us the number of ways to export the Table data one of the ways is CSV(Comma Separated Value).

There are two ways to create a CSV file with PHP –

  • By comma separated string, or
  • using fputcsv() method

I am using the fputcsv() method (writes an array to the file line by line) in the demonstration, where I am listing MySQL table data in the Tabular format and a button to export data.

When the export button gets clicked then creating a new CSV file and downloading it.

http://makitweb.com/how-to-export-mysql-table-data-as-csv-file-in-php/

DataBase PHP