-
September 16th, 2018, 16:50
#11
عضو انجمن
پاسخ : ساخت صفحه html جستجو و تب دار
id="myTable از جداول پاک کنید
بعد قسمت جاوا اسکریپت به این صورت وارد کنید :
کد:
$(document).ready(function () {
$(document).on("keyup",'.filter', function(e){
var value = $(this).val().toLowerCase();
$(this).parent().find("table tr").filter(function(){
$(this).toggle($(this).text().toLowerCase().indexOf(value) > -1);
});
});
});
کد نهای به این شکل بدون تغییر » https://jsfiddle.net/sk654pfe/1/
هم تب کار میکنه هم جستجو در هر جدول به تنهایی انجام میشه
فقط برای نمایش style="margin-top: 320px;" اضافه کردم که تو سیستم خودتون میتونید پاکش کنید
لینک های js , css هم که از حالا کامند خارج کنید
If you do what you've always done, you'll always get the same result
Life is too short to be normal ! Stay Weird
-
تعداد تشکر ها از data20 به دلیل پست مفید
-
September 16th, 2018 16:50
# ADS
-
September 17th, 2018, 13:33
#12
پاسخ : ساخت صفحه html جستجو و تب دار

نوشته اصلی توسط
data20
id="myTable از جداول پاک کنید
بعد قسمت جاوا اسکریپت به این صورت وارد کنید :
کد:
$(document).ready(function () {
$(document).on("keyup",'.filter', function(e){
var value = $(this).val().toLowerCase();
$(this).parent().find("table tr").filter(function(){
$(this).toggle($(this).text().toLowerCase().indexOf(value) > -1);
});
});
});
کد نهای به این شکل بدون تغییر »
https://jsfiddle.net/sk654pfe/1/
هم تب کار میکنه هم جستجو در هر جدول به تنهایی انجام میشه
فقط برای نمایش style="margin-top: 320px;" اضافه کردم که تو سیستم خودتون میتونید پاکش کنید
لینک های js , css هم که از حالا کامند خارج کنید
ممنون امکان داره ای دی تلگرام بدید؟
کد هارو که وارد میکنم جستجو کار میکنه اما همه جدول ها دیتاشون یکیه محتوا عوض نمیشه...
مثلا همه کلمه amir را نشان میدن هر تبی باشم فرقی نمیکنه
البته من " id="myTable از جداول پاک کنید" پیدا نکردم...
این کد جاوا داخل همون table.js که خودم ساختم وارد کنم؟
یا پایین هر جدول قبل از بسته شدن div ها
ویرایش توسط AHF-victory : September 17th, 2018 در ساعت 13:36
-
-
September 17th, 2018, 16:16
#13
عضو انجمن
پاسخ : ساخت صفحه html جستجو و تب دار
اگر id تلگرام امضاتون درست ه بهتون پیام میدم
کد جاوارو همون جوری در فایلی که در نظر دارید قرار بدید و فقط 1 بار لازم و خودش هر چند تا جدولی که ایجاد کنید کنترل میکنه
کد HTML:
$(document).ready(function () { $(document).ready(function () {
$(document).on("keyup",'.filter', function(e){
var value = $(this).val().toLowerCase();
$(this).parent().find("table tr").filter(function(){
$(this).toggle($(this).text().toLowerCase().indexOf(value) > -1);
});
});
}); });
هم تو قایلی که پیوست کردید هم تو پست خودتون myTable هست در تگ tbody که قرمز کردمش

نوشته اصلی توسط
AHF-victory
کل کد
کد:
<div class="container">
<h2>Dynamic Tabs</h2>
<ul class="nav nav-tabs">
<li class="active"><a data-toggle="tab" href="#home">Home</a></li>
<li><a data-toggle="tab" href="#menu1">Menu 1</a></li>
<li><a data-toggle="tab" href="#menu2">Menu 2</a></li>
<li><a data-toggle="tab" href="#menu3">Menu 3</a></li>
</ul>
<div class="tab-content">
<div id="home" class="tab-pane fade in active">
<div class="container">
<h2>Filterable Table</h2>
<p>Type something in the input field to search the table for first names, last names or emails:</p>
<input class="form-control filter" type="text" placeholder="Search..">
<br>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>Firstname</th>
<th>Lastname</th>
<th>Email</th>
</tr>
</thead>
<tbody id="myTable">
<tr>
<td>amir</td>
<td>Doe</td>
<td>john@example.com</td>
</tr>
<tr>
<td>Mary</td>
<td>Moe</td>
<td>mary@mail.com</td>
</tr>
<tr>
<td>July</td>
<td>Dooley</td>
<td>july@greatstuff.com</td>
</tr>
<tr>
<td>Anja</td>
<td>Ravendale</td>
<td>a_r@test.com</td>
</tr>
</tbody>
</table>
<p>Note that we start the search in tbody, to prevent filtering the table headers.</p>
</div>
</div>
<div id="menu1" class="tab-pane fade">
<div class="container">
<h2>Filterable Table</h2>
<p>Type something in the input field to search the table for first names, last names or emails:</p>
<input class="form-control filter" type="text" placeholder="Search..">
<br>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>Firstname</th>
<th>Lastname</th>
<th>Email</th>
</tr>
</thead>
<tbody id="myTable">
<tr>
<td>no</td>
<td>Doe</td>
<td>john@example.com</td>
</tr>
<tr>
<td>Mary</td>
<td>Moe</td>
<td>mary@mail.com</td>
</tr>
<tr>
<td>July</td>
<td>Dooley</td>
<td>july@greatstuff.com</td>
</tr>
<tr>
<td>Anja</td>
<td>Ravendale</td>
<td>a_r@test.com</td>
</tr>
</tbody>
</table>
<p>Note that we start the search in tbody, to prevent filtering the table headers.</p>
</div>
</div>
<div id="menu2" class="tab-pane fade">
<div class="container">
<h2>Filterable Table</h2>
<p>Type something in the input field to search the table for first names, last names or emails:</p>
<input class="form-control filter" type="text" placeholder="Search..">
<br>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>Firstname</th>
<th>Lastname</th>
<th>Email</th>
</tr>
</thead>
<tbody id="myTable">
<tr>
<td>John</td>
<td>Doe</td>
<td>john@example.com</td>
</tr>
<tr>
<td>Mary</td>
<td>Moe</td>
<td>mary@mail.com</td>
</tr>
<tr>
<td>July</td>
<td>Dooley</td>
<td>july@greatstuff.com</td>
</tr>
<tr>
<td>Anja</td>
<td>Ravendale</td>
<td>a_r@test.com</td>
</tr>
</tbody>
</table>
<p>Note that we start the search in tbody, to prevent filtering the table headers.</p>
</div>
</div>
<div id="menu3" class="tab-pane fade">
<div class="container">
<h2>Filterable Table</h2>
<p>Type something in the input field to search the table for first names, last names or emails:</p>
<input class="form-control filter" type="text" placeholder="Search..">
<br>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>Firstname</th>
<th>Lastname</th>
<th>Email</th>
</tr>
</thead>
<tbody id="myTable">
<tr>
<td>John</td>
<td>Doe</td>
<td>john@example.com</td>
</tr>
<tr>
<td>Mary</td>
<td>Moe</td>
<td>mary@mail.com</td>
</tr>
<tr>
<td>July</td>
<td>Dooley</td>
<td>july@greatstuff.com</td>
</tr>
<tr>
<td>Anja</td>
<td>Ravendale</td>
<td>a_r@test.com</td>
</tr>
</tbody>
</table>
<p>Note that we start the search in tbody, to prevent filtering the table headers.</p>
</div>
</div>
</div>
</div>
ویرایش توسط data20 : September 17th, 2018 در ساعت 23:58
If you do what you've always done, you'll always get the same result
Life is too short to be normal ! Stay Weird
-
-
September 18th, 2018, 11:09
#14
پاسخ : ساخت صفحه html جستجو و تب دار

نوشته اصلی توسط
data20
اگر id تلگرام امضاتون درست ه بهتون پیام میدم
کد جاوارو همون جوری در فایلی که در نظر دارید قرار بدید و فقط 1 بار لازم و خودش هر چند تا جدولی که ایجاد کنید کنترل میکنه
کد HTML:
$(document).ready(function () { $(document).ready(function () {
$(document).on("keyup",'.filter', function(e){
var value = $(this).val().toLowerCase();
$(this).parent().find("table tr").filter(function(){
$(this).toggle($(this).text().toLowerCase().indexOf(value) > -1);
});
});
}); });
هم تو قایلی که پیوست کردید هم تو پست خودتون myTable هست در تگ tbody که قرمز کردمش
بله ممنون amirhosseinfallah
ویرایش توسط AHF-victory : September 18th, 2018 در ساعت 11:10
-