Tags » Code Snippet

Formatting Phone Numbers In PHP

To format a phone number before displaying it on the page, you can use the following function. This function insert spaces so that the phone number becomes easier to read by the user. 110 more words

Code Snippet

Create Fullscreen HTML5 Background Video

Adding a Background Video to your website is pretty easy with HTML5 Video tag.


<div class="video_container">
<video autoplay loop poster="includes/sample.jpg" id="vid">
<source src="includes/sample.webm" type="video/webm">
<source src="includes/sample.mp4" type="video/mp4">
</video>
</div>

… 58 more words
Code Snippet

Allow Only Numbers In a Text Box Using JQuery

In some occasions you might have to disable alphabets in a text field and only allow numbers. For example, in fields like phone number or amount. 96 more words

Code Snippet

Remove Contents and Delete The Directory in PHP

With the below PHP code you can recursively delete all the contents in the directory and then the directory itself.  This function checks for sub files and sub directories and delete them first before deleting the main folder. 36 more words

Code Snippet

Centering Bootstrap Modal Window Using JQuery

By default the Bootstrap Modal Window is centered horizontally, but not vertically. If you want to vertically center the Modal, you can use the following JQuery Code. 24 more words

Code Snippet

Hide Contents If Javascript is Disabled

Currently most of the content rich websites depend mostly on Javascript. But If the user has Javascript disabled in his browser your website will fail to perform as you expected. 77 more words

Code Snippet

File Upload Validation Using JQuery

If in HTML Form, you have a file input, you can validate the extensions as soon as the user upload a file using the JQuery Code given below : 140 more words

Code Snippet