Jquery

How to Integrate Bootsrap Model Box with Jquery Template

In This post I will tell you how to add jquery template in bootsrtap Model box.Normally we are using inline code to add model box functionality but now its old technique, now everything is changing.We are using bootstrap model box and Jquery template plugin.We are not including library file of model box and jquery template , I understand you have to basic knowledge of Jquery template and Bootstrap model box.

Yo can also Checkout other Modal Box tutorial,

Simple Steps to Integrate Model Box with jQuery Template:

Objective of Example: we are creating detail of attributes based on attribute id.

Step 1: Create bootstrap model box.

Step 1.1 : adding hyperlink for popup model box.

         <a href="#changeHistoryModal" role="button" class="history-details" data-toggle="modal">Click me </a>

Step 1.2: adding Model box HTMl layout in file.

Related Post
     <!-- Modal -->


<div id="changeHistoryModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">


<div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>


<h3 id="myModalLabel">Change History</h3>


</div>




<div class="modal-body">
    Hi I am body of model
</div>




<div class="modal-footer">
    <button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
</div>


</div>


Step 2: Integrating template in bootstrap model box.

Step 2.1: adding template in model box, So now step 1.1 code would be change as below:

<!-- Modal -->


<div id="changeHistoryModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">


<div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>


<h3 id="myModalLabel">Change History</h3>


</div>




<div class="modal-body">


<table class="table table-condensed table-striped table-hover extended-font" width="100%" id="history-details" cellspacing="1">


<thead>

<tr class="error">


<th>Column Name</th>




<th>Origional Value</th>




<th>Modified Value</th>




<th>Modified Date</th>


</tr>

</thead>




<tbody id="history-details-div"></tbody>

</table>


</div>




<div class="modal-footer">
    <button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
</div>


</div>


Step 2.2: adding template layout:

 <!-- jQuery JS Tempalate Start for details  -->         
   <script id="changeHistoryDetailsLog" type="text/x-jquery-tmpl">
        <tr class="success"><td>${columnName}</td>
            <td>${origionalValue}</td>
            <td>${modifiedValue}</td>
   <td>${creationDate}</td>
        </tr>
    </script>

Step 2.3:Fill the Json object in template and display in div.

 <!-- jQuery JS Template Start for details  -->         
   <script id="changeHistoryDetailsLog" type="text/x-jquery-tmpl">
        <tr class="success"><td>${columnName}</td>
            <td>${origionalValue}</td>
            <td>${modifiedValue}</td>
   <td>${creationDate}</td>
        </tr>
    </script>

Demo & Example of Bootsrap Model Box with Jquery Template

Recent Posts

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

2 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

2 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

2 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

3 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

3 months ago

Common Practices for Laravel Blade Template

in this Laravel tutorial, I will explore common practices for using the Laravel Blade template with examples. Blade is a… Read More

3 months ago

Categories