我正在尝试将 jQuery 颜色选择器放入我的网站。lindekleiv 的颜色选择器不工作。我拥有的代码是:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
<script>
$('input#myColorPicker').colorPicker({
format: 'hex',
size: 100
});
</script>
页面的完整代码:
<!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">
<link rel="stylesheet" type="text/css" href="../css/mainpage.css" media="screen" />
<link href='http://fonts.googleapis.com/css?family=Open+Sans|Josefin+Slab:400,700,700italic,400italic' rel='stylesheet' type='text/css' />
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
<script src="jquery.ui.colorPicker.min.js"></script>
<script>
$(function() { // Wait for page to load
$('#myColorPicker').colorPicker({
format: 'hex',
size: 100
});
});
</script>
</head>
<body>
<div id="head">
<h1><span>Welcome to CodeTowel©.</span></h1>
<h1>The place to code, with help from Towel!</h1>
</div>
<p>Snippets are bits of code that you can download and put into your webpage. We have seperate snippets for the <code><code></code>, <code><pre></code>, and <code><kbd></code> elements.</p>
<p>Don't like the colors for the current website? Change 'em!</p>
<input id="myColorPicker" type="text" />
</body>
</html>