Categories: Jquery

How to add color picker in jQuery/Html and Php

Now we are discussing how to add color picker in php/html project, for example if you want give a functionality to user select color from color picker for his background color profile,for this we will use third party color picker and call it on particular div area where we want display color picker.

Step 1: first we will include farbtastic css and js file.

 
<script type="text/javascript" src="js/colorpicker/farbtastic.js"></script>
 <link type="text/css" rel="stylesheet" href="css/farbtastic.css" />

Step 2: we will call color picker method on document ready event.

Related Post
 
$(document).ready(function () {  
  $('#pickerleft').farbtastic('#colorleft');
});

colorright/ colorleft’ is text-box id where we will show color id

Step 3: we will create html template for display color picker.

 
<table width="100%">
<tr><td colspan="2" height="34px;" ><h4 class="green-text roundeddiv shadowImgae" style="padding-left:22px;">Background Color Management:</h4></td></tr>
<tr>
<td width="27%" style="padding-right:20px;"><div id="pickerleft"></div></td>
   <td width="70%" >
<form action="index.php?action=bgcolor&mode=add" method="post" enctype="multipart/form-data">
<table><tr><td>
<label for="file">left<label><td>
<td><input type="text" id="colorleft" name="colorleft" value="<= $bg_colorleft ?>" />
</td>
</tr>
</table>

View Comments

Recent Posts

Configure and Retrieve S3 Information Using Laravel PHP-AWS-SDK

This tutorial helps integrate a PHP SDK with Laravel. We'll install aws-php-sdk into laravel application and access all aws services… Read More

3 months ago

What is the Purpose of php_eol in PHP?

in this quick PHP tutorial, We'll discuss php_eol with examples. PHP_EOL is a predefined constant in PHP and represents an… Read More

9 months ago

Laravel Table Relationship Methods With Example

This Laravel tutorial helps to understand table Relationships using Elequonte ORM. We'll explore laravel table Relationships usage and best practices… Read More

9 months ago

Exploring the Power of Laravel Eloquent Join?

We'll explore different join methods of Laravel eloquent with examples. The join helps to fetch the data from multiple database… Read More

9 months ago

Quick and Easy Installation of Laravel Valet

in this Laravel tutorial, We'll explore valet, which is a development environment for macOS minimalists. It's a lightweight Laravel development… Read More

10 months ago

What is Laravel Soft Delete and How Does it Work?

I'll go through how to use soft delete in Laravel 10 in this post. The soft deletes are a method… Read More

10 months ago

Categories