在整个网站上有一些类似的问题,但他们都没有给我我正在寻找的答案.
我想要做的是在具有WAMP的Windows机器上通过Git Bash安装Composer.
我正在使用以下命令:
curl -s http://getcomposer.org/installer | php
Run Code Online (Sandbox Code Playgroud)
这不起作用,因为"php"无法识别.所以我调查了问题,我意识到Windows不知道'php'是什么,我需要设置一个环境变量.
我进入环境变量对话框并输入'php'作为变量和C:\wamp\bin\php\php5.3.8值.它是否正确?我应该针对特定文件还是整个目录?
执行此操作后,我再次尝试该命令,但它失败了,因为它仍然无法识别'php'.我也尝试直接将文件路径放入命令,但这也不起作用.
所以我很好奇我做错了什么.我的路径不正确吗?
我需要这个脚本来隐藏我的复选框并放置一个样式复选框的图像来代替它.它正确地隐藏它并显示默认图像,但是一旦我点击它就不会更新复选框以选中或取消选中它,也不会更新图像.我假设这是一个我忽略的简单事情,我仍然是jQuery的新手.
这是脚本:
$(".check").each(function() {
$(this).hide();
var $image = $("<img src='assets/images/layout/checkbox/unchecked.png' />").insertAfter(this);
$image.click(function() {
var $checkbox = $(this).prev(".check");
$checkbox.prop('checked', !$checkbox.prop('checked'));
if($checkbox.prop("checked")) {
$image.attr("src", "assets/images/layout/checkbox/checked.png");
} else {
$image.attr("src", "assets/images/layout/checkbox/unchecked.png");
}
})
});
Run Code Online (Sandbox Code Playgroud)
这是HTML:
<input type="checkbox" class="check" />
Run Code Online (Sandbox Code Playgroud)
编辑:此外,这通常是样式复选框的最佳方法吗?我似乎找不到比这更容易的东西,所以任何建议都值得赞赏.
我对jQuery不是很好,所以请对我很轻松.
我有这个脚本:
$(document).ready(function() {
$(".item").click(function() {
if($(this).find("input").attr("checked")) {
$(this).css("background-color", "#d1d1d1");
$(this).find("input").removeAttr("checked");
} else {
$(this).css("background-color", "#03d100");
$(this).find("input").attr("checked", "checked");
}
});
});
Run Code Online (Sandbox Code Playgroud)
适用于此HTML:
<ul class="col-1">
<li class="item">
<input type="checkbox" />
<label for="">Check Up</label>
<span class="float-r">$19</span>
</li>
...
</ul>
Run Code Online (Sandbox Code Playgroud)
这在大多数情况下都有效.我想要的是点击'li',改变背景颜色,并将其中的复选框设置为'checked'.这样做,但它不允许我实际单击复选框本身并将其更改为选中或取消选中.
我认为脚本中有些东西我做错了但是我不熟悉jQuery知道.
我似乎无法弄清楚这里的问题是什么.我已经尝试将我的js放在我的脑海里,在我的表格之下,在我的表格之上,等等.他们似乎都没有做任何事情.它只是在没有尝试验证的情况下提交页面
HTML:
<div class="content">
<h1>Submit A Lost Paw</h1>
<p>Please complete the form below. After being reviewed by a moderator, your listing will be posted for others to see.</p>
<ul id="error-box">
</ul>
<form id="test" name="test" action="test.php" method="post">
<div class="section">
<div class="input-title">
<label for="pet_name">Pet Name:</label>
</div>
<div class="input">
<input id="pet_name" type="text" />
</div>
<div class="clear"></div>
</div>
<div class="section">
<div class="input-title">
<label for="date_missing">Date Pet Went Missing:</label>
</div>
<div class="input">
<input id="date_missing" type="text" />
</div>
<div class="clear"></div>
</div>
<div class="section">
<div class="input-title">
<label for="location">Location:</label> …Run Code Online (Sandbox Code Playgroud)