  | 
              
	              
	                
  
    
	 
        jquery ทำงานพร้อมกันไม่ได้ค่ะ แก้ไขยังไงคะ พอใส่อีกตัวทำงานได้ พอเอาออกก็อีกตัวที่ทำงานได้     | 
   
  
    |   | 
   
 
 
 
	
		
			  | 
	   | 
	    | 
		
			  | 
	 
	
		
			  | 
		 		   | 
	  	    
          
            
			
	
			
			 
                Code (JavaScript) 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="bootstrap-3.3.7/dist/css/bootstrap.min.css">
  <link rel="stylesheet" href="jquery-ui-1.11.4.custom.css">
  <link rel="stylesheet" href="jquery-ui-1.8.10.custom.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
  <script type="text/javascript" src="jquery-1.4.4.min.js"></script>
  <script type="text/javascript" src="jquery-ui-1.11.4.custom.js"></script>
 
  <script type="text/javascript" src="jquery-ui-1.8.10.offset.datepicker.min.js"></script>
  
  
  
<script type="text/javascript">
	$( function() {
		
		  
		
            $( "#dateSearch" ).datepicker({
				
                dateFormat: 'yy-mm-dd',
				minDate: 1,
				monthNames: ["มกราคม","กุมภาพันธ์","มีนาคม","เมษายน","พฤษภาคม","มิถุนายน","กรกฎาคม","สิงหาคม","กันยายน","ตุลาคม","พฤศจิกายน","ธันวาคม"],
				dayNamesMin: ["อา","จ","อ","พ","พฤ","ศ","ส"], // Column headings for days starting at Sunday
				yearOffset:543,  // ใช้ปี พ.ศ. บวก 543 เพิ่มเข้าไปในปี ค.ศ
                language: 'th',
				isBuddhist: true
            });
			 $.datepicker.setDefaults($.datepicker.regional['th']);
            
            document.getElementById('course_id').innerHTML = $_GET['course_id'];
	});
 
    function checkAll() {
        $("input[id*='chkAll']:checkbox").click(function () {
            $("input[id*='booking']:checkbox").not(":disabled").attr('checked', $(this).is(':checked'));
        });
    };
</script>
<body>
<div class="container">
<div class="form-group  form-inline" >
  <table width="1113" border="0" align="center">
    <tr>
      <td height="100" colspan="3"><img src="img/h1.jpg" width="1113" height="100" /></td>
    </tr>
    <tr>
<?php
	$sql_position = "
            SELECT
               user_id,
               position_id
            FROM USER u
            where user_id = ".$_SESSION['user_id']."
        ";
        
	$queries = mysql_query($sql_position);
        $rowss = mysql_fetch_array($queries);
?> 
       <td colspan="3"><table width="1117" border="0"  dir="ltr"> 
        <tr>
          <td >            
              <?php if ($rowss['position_id'] == 1) { ?>
                <td><?php include "menu_admin.php";?></td>
              <?php } else if ($rowss['position_id'] == 2) { ?>
                <td><?php include "menu.php";?></td>
              <?php } else {?>
                <td><?php include "menu.php";?></td>          
        <?php } ?>
          </td>
        </tr>
      </table></td>
      </tr>
    <tr>
      <td width="230" valign="top"><table width="236" border="0">
        <tr>
          <td width="457" valign="top"><p><img src="img/images/booking_01.gif" width="230" height="49" /><a href="sercharge_f.php"><img src="img/images/booking_02.gif" width="229" height="46" /></a><img src="img/images/booking_03.gif" width="1" height="46" /><img src="img/images/booking_04.gif" width="230" height="46" /><img src="img/images/booking_05.gif" width="230" height="46" /><img src="img/images/booking_07.gif" width="229" height="43" /><img src="img/images/booking_09.gif" width="229" height="46" /><img src="img/images/booking_10.gif" width="229" height="46" /><img src="img/images/booking_11.gif" width="229" height="46" /><img src="img/images/booking_13.gif" width="230" height="46" /><img src="img/images/booking_14.gif" width="229" height="46" /><img src="img/images/booking_15.gif" width="1" height="46" /></p></td>
        </tr>
      </table></td>
      <td width="873" colspan="2" align="center" valign="top">
	  <p><img src="img/checkin.png" width="44" height="44" /><label>เลือกจองสนามฟุตบอล</label></p>
	  
      <p><strong>วันนี้: </strong>
        <?=thai_date_and_time(time())?></p>
      <p>
        <label for="dateSearch">เลือกวันที่ : </label>
        <input type="text" name="dateSearch" id="dateSearch"  class="form-control" placeholder="วัน-เดือน-ปี" data-date-language="th"/>
        
        <label for="field">เลือกสนาม : </label>
        <select name="course_id" id="course_id" class="form-control" onchange="">
          <?php if(!$_SESSION['course_id']) { ?>
          <option value="0" selected="selected" disabled="disabled">--กรุณาเลือกสนามฟุตบอล--</option>
          <?php } ?>
          <?php			 
	$sql = "select * from field order by field_id asc;";
	$query = mysql_query($sql);
	mysql_query("SET character_set_results=utf8");
	mysql_query("SET character_set_client=utf8");
	mysql_query("SET character_set_connection=utf8");
	while($row = mysql_fetch_array($query)){
        ?>
          <option value="<?php echo $row['field_id']; ?> "><?php echo $row['field_name']."  (".$row['field_detail'].")"; ?></option>
          <?php	} ?>
        </select>
        
        <input type="button" name="search" id="search" class="btn btn-success" value="ค้นหา" onclick="
        var dateSearch = document.getElementById('dateSearch').value;
        var course_id = document.getElementById('course_id').value;
        var fieldNum = 0;
        if(dateSearch && course_id > 0) {
            var showTableAPI = 'booking_table.php?dateSearch=' + dateSearch + '&field_id=' + course_id;                
            var xmlhttp = new XMLHttpRequest();
			var fieldNum = 0;
            xmlhttp.onreadystatechange=function() {
                if (this.readyState==4 && this.status==200) {
                    document.getElementById('dataTable').innerHTML = this.responseText;
                    $('#UnCheckAll').click(function(){
						$('.messageCheckbox').prop('checked',false);
						$('#showprice').html(0);
                        $('#fieldNum').html(0) ;
                        
                    });
                    
                	  $('.messageCheckbox').click(function(){
                       var priceID=$(this).val();
                       var priceold=parseInt($('#showprice').html());
                        
                       fieldNum += this.checked ? 1 : -1;	// ตรวจสอบ ปุ่มเช็ค เขียนใน event click
                       $('#fieldNum').html(fieldNum);	//# = ID, . = ตัวแปร
                       
                       if($(this).prop('checked')==true){
						$.get('checkprice.php?price='+priceID, function(data){
                       // alert(data);
                       var pricenew= priceold + parseInt(data);
                       $('#showprice').html(pricenew);
                        });
                        
                       }else{
                       $.get('checkprice.php?price='+priceID, function(data){
                       // alert(data);
                       var pricenew = priceold - parseInt(data);
                       $('#showprice').html(pricenew);
                       });
                       } 
                    });
                                                        
                }
            }
            xmlhttp.open('POST',showTableAPI,true);
            xmlhttp.send();                
        } else {
            alert('กรุณาเลือกวันที่ และสนามค่ะ');
            exit;
        }  
    "/>
        
      </p>
      <table id="dataTable" style="background-color: white; margin-top: 10px; user-select: none;"></table>
    
    
<script type="text/javascript">
    $('#chkSubmitt').click(function(){
        var val = [];
        $(':checkbox:checked').each(function(i){
            val[i] = $(this).val();
            console.log($(this).val());
            });
    });
</script>
</body>
</html> 
 
 
ปัญหาอยู่ที่ <script type="text/javascript" src="jquery-1.4.4.min.js"></script> ค่ะ ไมม่รู้ว่าต้องแก้ยังไง ช่วยหน่อยนะคะ
 
 
  Tag : PHP, jQuery               
                        | 
           
          
            
		
  ประวัติการแก้ไข 2018-10-25 20:24:46	
                             | 
           
          
            
              
                   | 
                   | 
                   | 
               
              
                   | 
                
                    
                      | Date :
                          2018-10-25 20:22:08 | 
                      By :
                          1851112778284115 | 
                      View :
                          957 | 
                      Reply :
                          3 | 
                     
                  | 
                   | 
               
              
                   | 
                   | 
                   | 
               
              | 
           
          
            | 
			 | 
           
         
	    
		             | 
		
			  | 
	 
	
		
			  | 
		  | 
		
			  | 
		
			  | 
	 
 
              
  
          
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 ตัว 3.3.1 ไม่ครอบคลุมเหรอครับ ผมใช้ 3.3.1 ตัวเดียว กับ bootstrap ก็ครอบคลุมทุกอย่างแล้วอะครับ 
 
แต่ถ้าจำเป็นจริงๆ (ซึ่งไม่น่าจะเป็นอย่างนั้น) 
ลองค้น jquery conflict ดูครับ                        
               
               | 
             
            
              
			                              
                              
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2018-10-25 23:18:40 | 
                        By :
                            Chaidhanan | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
               
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 ลองดู Error จาก console ใน chrome เอาไป search อีกทีอาจจะช่วยได้ครับ                        
               
               | 
             
            
              
			                              
                              
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2018-10-26 01:40:07 | 
                        By :
                            apisitp | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
               
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 ตามคห. 1 ว่า ใช้มันแค่อันเดียวก็พอแล้ว จะใช้ทำไมพร้อมๆกันหลายอัน  
ถ้าใช้ของใหม่ แล้วมันเจอ error อะไรใน console ก็เอามาหาวิธีเขียนในเวอร์ชั่นใหม่ๆซะ ตัวอย่างเช่น ถ้าเคยใช้ .live() ก็เปลี่ยนมาใช้ .on() เป็นต้น. 
 
พยายามแยกเอา css เท่านั้นไว้ใน <head>...</head> 
เอา js ทั้งที่เรียกเป็นไฟล์และเป็น inline ไว้ด้านล่างก่อนปิด </body> 
เพื่อให้หน้านั้นทำงานได้รวดเร็วและมีปัญหาน้อยกว่าในการทำงานกับ DOM ถ้าเผลอไม่ได้เขียนการทำงานใส่ไปในตอนที่ DOM โหลดแล้ว.                        
               
               | 
             
            
              
			                              
                              
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2018-10-26 19:12:52 | 
                        By :
                            mr.v | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
      		  
	
     | 
   
 
                 |