ThaiSEOBoard.com

พัฒนาเว็บไซต์ => Programming => ข้อความที่เริ่มโดย: deknakhon ที่ 17 กันยายน 2011, 21:55:40



หัวข้อ: ช่วยดู Jquery ให้ผมหน่อยครับ
เริ่มหัวข้อโดย: deknakhon ที่ 17 กันยายน 2011, 21:55:40
ปัญหาตอนนี้คือเลือกวันที่แล้วต้อง Click อีกครั้งถึงข้อมูลจะแสดงออกมา และ พอ click เปลี่ยนวันที่ ก็ไม่ Refresh ข้อมูลให้



โค๊ด:
$(function(){

$("#ARRIVE" ).datepicker({
            dateFormat: 'yy-mm-dd',
    minDate: +1,
    numberOfMonths: 2,
    changeMonth: true,
    changeYear: true,
            showOn: "both",
    showButtonPanel: true
           
});
       $("#ARRIVE").click(function () {
$('#msg').html($('#ARRIVE').val());
 
    });
       
     
        $("#DEPART").datepicker({
         dateFormat: 'yy-mm-dd',
         minDate: +2,
         numberOfMonths: 2,
changeMonth: true,
changeYear: true,
showOn: "both",
         showButtonPanel: true
});

        $("#DEPART").click(function () {
$('#msg1').html($('[NAME=DEPARTCHK]').val());
 
    });
});


ต้องการแสดงข้อมูลออกมามาหลักจากเลือกวันที่แล้ว
โค๊ด:
<h4>DEPART value : <label id="msg"></label></h4>
 <h4>ARRIVE value : <label id="msg1"></label></h4>





หัวข้อ: Re: ช่วยดู Jquery ให้ผมหน่อยครับ
เริ่มหัวข้อโดย: marus ที่ 18 กันยายน 2011, 16:20:31
ลองเปลี่ยนจาก click เป็น change ดู


หัวข้อ: Re: ช่วยดู Jquery ให้ผมหน่อยครับ
เริ่มหัวข้อโดย: bonshington ที่ 19 กันยายน 2011, 13:22:33
$('#msg1').text($("[NAME='DEPARTCHK']").val());


หัวข้อ: Re: ช่วยดู Jquery ให้ผมหน่อยครับ
เริ่มหัวข้อโดย: iCeEffecT ที่ 19 กันยายน 2011, 14:23:14
โค๊ด:
$(function(){

$("#ARRIVE" ).datepicker({
            dateFormat: 'yy-mm-dd',
    minDate: +1,
    numberOfMonths: 2,
    changeMonth: true,
    changeYear: true,
            showOn: "both",
    showButtonPanel: true,
    onSelect: function(dateStr){
$('#msg').html(dateStr);
    }
});
       
        $("#DEPART").datepicker({
         dateFormat: 'yy-mm-dd',
         minDate: +2,
         numberOfMonths: 2,
changeMonth: true,
changeYear: true,
showOn: "both",
         showButtonPanel: true,
onSelect: function(dateStr){
             $('#msg1').html(dateStr);
}
});

});
:wanwan020: