|
![](/images/resource/spacer.gif) |
|
พี่ๆครับผมอยากเปลี่ยนการค้นหาให้ขึ้นตรงที่ตามเราเลือกอ่าครับ |
|
![](/images/resource/viewboard_01.gif?v=1001) |
|
|
![](/images/resource/viewboard_03.gif?v=1001) |
![](/images/resource/viewboard_04.gif?v=1001) |
|
ใช้ javascript ช่วย
ตัวอย่าง jquery
Code (JavaScript)
$('select').change(function(e){
$('#txt_search').attr('placeholder', $(this + ' option:selected").text() );
}
|
![](/images/resource/blockviewtopic_01.gif?v=1001) |
![](/images/resource/blockviewtopic_02.gif?v=1001) |
![](/images/resource/blockviewtopic_03.gif?v=1001) |
![](/images/resource/blockviewtopic_04.gif?v=1001) |
Date :
2015-09-14 11:15:29 |
By :
NewbiePHP |
|
![](/images/resource/blockviewtopic_06.gif?v=1001) |
![](/images/resource/blockviewtopic_07.gif?v=1001) |
![](/images/resource/blockviewtopic_08.gif?v=1001) |
![](/images/resource/blockviewtopic_09.gif?v=1001) |
|
|
![](/images/resource/viewboard_06.gif?v=1001) |
![](/images/resource/viewboard_07.gif?v=1001) |
|
![](/images/resource/viewboard_08.jpg?v=1001) |
![](/images/resource/viewboard_09.gif?v=1001) |
![](/images/resource/viewboard_01.gif?v=1001) |
|
|
![](/images/resource/viewboard_03.gif?v=1001) |
![](/images/resource/viewboard_04.gif?v=1001) |
|
รบกวนขอตัวอย่าง สักอันได้ไหมครับ พอดีผมดูแล้วไม่ค่อยเข้าใจรบกวนทีนะครับ
|
![](/images/resource/blockviewtopic_01.gif?v=1001) |
![](/images/resource/blockviewtopic_02.gif?v=1001) |
![](/images/resource/blockviewtopic_03.gif?v=1001) |
![](/images/resource/blockviewtopic_04.gif?v=1001) |
Date :
2015-09-14 11:26:52 |
By :
์Noonayzaa |
|
![](/images/resource/blockviewtopic_06.gif?v=1001) |
![](/images/resource/blockviewtopic_07.gif?v=1001) |
![](/images/resource/blockviewtopic_08.gif?v=1001) |
![](/images/resource/blockviewtopic_09.gif?v=1001) |
|
|
![](/images/resource/viewboard_06.gif?v=1001) |
![](/images/resource/viewboard_07.gif?v=1001) |
|
![](/images/resource/viewboard_08.jpg?v=1001) |
![](/images/resource/viewboard_09.gif?v=1001) |
![](/images/resource/viewboard_01.gif?v=1001) |
|
|
![](/images/resource/viewboard_03.gif?v=1001) |
![](/images/resource/viewboard_04.gif?v=1001) |
|
Code (PHP)
<!DOCTYPE html>
<html>
<head>
<script src="/jquery-2.1.1.min.js"></script>
<script>
$(document).ready(function(e){
$('select').change(function(e){
$('#txt_search').attr('placeholder', $(this).find('option:selected').data('msg') );
});
});
</script>
</head>
<body>
<select>
<option value="1" data-msg="แสดงรายการ A" >รายการ A</option>
<option value="2" data-msg="แสดงรายการ B" >รายการ B</option>
<option value="3" data-msg="แสดงรายการ C" >รายการ C</option>
<option value="4" data-msg="แสดงรายการ D" >รายการ D</option>
</select>
<input type="text" id="txt_search" placeholder="A">
</body>
</html>
|
ประวัติการแก้ไข 2015-09-14 11:50:43
![](/images/resource/blockviewtopic_01.gif?v=1001) |
![](/images/resource/blockviewtopic_02.gif?v=1001) |
![](/images/resource/blockviewtopic_03.gif?v=1001) |
![](/images/resource/blockviewtopic_04.gif?v=1001) |
Date :
2015-09-14 11:49:07 |
By :
NewbiePHP |
|
![](/images/resource/blockviewtopic_06.gif?v=1001) |
![](/images/resource/blockviewtopic_07.gif?v=1001) |
![](/images/resource/blockviewtopic_08.gif?v=1001) |
![](/images/resource/blockviewtopic_09.gif?v=1001) |
|
|
![](/images/resource/viewboard_06.gif?v=1001) |
![](/images/resource/viewboard_07.gif?v=1001) |
|
![](/images/resource/viewboard_08.jpg?v=1001) |
![](/images/resource/viewboard_09.gif?v=1001) |
|
|
|
![](/images/digitalocean-banner.jpg)
|
Load balance : Server 04
|