Jquery Mobile Multiple Select不允许我在Iphone上选择2个以上的选项

时间:2017-06-15 21:22:10

标签: jquery jquery-mobile

我正在尝试在Jquery移动中使用多选项,每次我尝试选择多个选项时,都会取消选中其他选项。这是我的代码,我错过了什么?在谷歌浏览器中,它甚至不会让我选择1个以上的选项。在iPhone上我可以选择2个选项。我在select上有data-native-menu =“false”。

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <title>Login</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <!-- Bootstrap -->
    <link rel="stylesheet" href="../css/themes/Estimates.css" />
	<link rel="stylesheet" href="../css/themes/jquery.mobile.icons.min.css" />
	<link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.5/jquery.mobile.structure-1.4.5.min.css" />
	<script src="http://code.jquery.com/jquery-1.11.1.min.js"></script>
	<script src="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
	<script type="application/javascript">
	$(document).on("pagecreate", "#page-form1", function() {
  		$("select").each(function(idx) {
    		$(this).change(function() {
      			var value = $(this).val();
      			$(this).children("option").removeAttr("selected");
      			$(this).children("option[value='" + value + "']").attr("selected", "selected");
      			if($(this).attr("id") == "Priority")
        			linkOptions(value);
    		});
  		});
	});

	function linkOptions(priority) {
  		var cases = {
    		
			"Normal": {
      			"commETA": "2 Days",
      			"compETA": "1 Week"
    		},
    		"High": {
      			"commETA": "Today",
      			"compETA": "2 Days"
    		},
			"Severe": {
      			"commETA": "Today",
      			"compETA": "Today"
    		},
			"Emergency": {
      			"commETA": "1 Hour",
      			"compETA": "Today"
    		}
  		};

  		if (cases[priority]) {
    		$.each(cases[priority], function(key, value) {
      			$("#" + key).val(value);
      			$("#" + key).trigger("change");
    		});
  		}
	}
	</script>
  </head>

  <body>
    <div data-role="page" id="page-form1" data-theme="a">
		<div data-role="header" data-position="inline">
			<h1>MGK Electric CTA</h1>
		</div>
		<div data-role="content" id="page-content1" data-theme="a">
       		<form class="form-signin" id="form1" method="post" action="<?php echo $formaction; ?>">
        		<h4 class="form-signin-heading" style="text-align: center;">Please describe CTA Below</h4>
        		<label style="font-weight: bold;">Customer Name:</label>
        		<input name="Customer_Name" id="Customer_Name" type="text" class="form-control" autofocus required="required"><br />
        		<label style="font-weight: bold;">Priority Level:</label>	
       		  	<select name="Priority" id="Priority" required>
        		  	<option value="">Please Select</option>
        		  	<option value="Normal">Normal</option>
        		  	<option value="High">High</option>
        		  	<option value="Severe">Severe</option>
        		  	<option value="Emergency">Emergency</option>
        		</select><br />
        		<label style="font-weight: bold;">Project:</label>
        		<input name="Project" id="Project" type="text" class="form-control"><br />
        		<label style="font-weight: bold;">Expected Time for Communication:</label>
        		<select name="commETA" id="commETA" required>
        			<option value="">Please Select</option>
       		  		<option value="1 Hour">1 Hour</option>
        		  	<option value="Today">Today</option>
        		  	<option value="2 Days">2 Days</option>
        		  	<option value="1 Week">1 Week</option>
        		  	<option value="2 Weeks">2 Weeks</option>
        		</select><br />
        		<label style="font-weight: bold;">Expected Time for Completion:</label>
        		<select name="compETA" id="compETA" required>
        			<option value="">Please Select</option>
        		  	<option value="Today">Today</option>
        		  	<option value="2 Days">2 Days</option>
        		  	<option value="1 Week">1 Week</option>
        		  	<option value="2 Weeks">2 Weeks</option>
        		  	<option value="1 Month">1 Month</option>
        		  	<option value="Unknown">Unknown</option>
        		</select><br />
        		<label style="font-weight: bold;">Description of Issue:</label>
        		<textarea name="issue" id="issue" required></textarea><br />
        		<label style="font-weight: bold;">Unknowns About Issue:</label>
        		<textarea name="unknowns" id="unknowns" required></textarea><br />
        		<label style="font-weight: bold;">People Involved in CTA:</label>
        		<textarea name="people" id="people" required></textarea>
        		<select multiple="multiple" data-native-menu="false" name="notify" id="notify" data-iconpos="left">
        		<option>Choose Employees</option>
        		<?php
					$users = $pdo->query($sql);
						foreach ($users as $row) {
    						print "<option value=\"". $row["Name"] ."\">".$row["Name"]."</option><br/>";
						}

					$users->execute();
				?>
       			</select>
        		<br /><br />
        		<input type="hidden" name="doform" value="doform">
        		<button name="Submit" id="submit" class="btn btn-lg btn-primary btn-block" type="submit">Submit CTA</button>

        		<div id="message"></div>
      		</form>

    	</div> <!-- /container -->

    <!-- Include all compiled plugins (below), or include individual files as needed -->
    //<script type="text/javascript" src="login/js/bootstrap.js"></script>
  </body>
</html>

0 个答案:

没有答案