我想在前24个孩子上添加一个悬停,在另一个元素的24个单独元素上添加填充.
像这样:
$('tr td:nth-child(1)').mouseover(function(){
$('rect:nth-of-type(1)').css("fill", "black" );
});
$('tr td:nth-child(2)').mouseover(function(){
$('rect:nth-of-type(2)').css("fill", "black" );
});
$('tr td:nth-child(3)').mouseover(function(){
$('rect:nth-of-type(3)').css("fill", "black" );
});
Run Code Online (Sandbox Code Playgroud)
但我不想重复自己24次.什么是处理这个的最好方法?
我想用jQuery选择一个元素.
<ul>
<li><label><input type="checkbox" class="checkbox">checkbox1</label></li>
<ul class="list">
<li>lorem</li>
<li>lorem</li>
<li>lorem</li>
</ul>
<li><label><input type="checkbox" class="checkbox">checkbox2</label></li>
<ul class="list">
<li>lorem</li>
<li>lorem</li>
<li><lorem/li>
</ul>
</ul>
Run Code Online (Sandbox Code Playgroud)
我想隐藏并显示直接在带有1 jQuery函数的复选框下面的列表.
$(".list").hide();
$(".checkbox").click(function() {
if ($(".checkbox").is(":checked"))
{
$("????").show('slow');
}
else
{
$("????").hide('slow');
}
});
Run Code Online (Sandbox Code Playgroud)
???? 需要是一个选择器(仅)选择复选框下的列表.
我想删除一个我只知道名字第一部分的文件.
unlink('./upload/nav_thumbs/project-' .the rest);
Run Code Online (Sandbox Code Playgroud)
'其余'=可以是任何东西.我唯一得到的是它有一个.jpg扩展名
有没有办法做到这一点?
我有很多带有复选框的列表,如下所示:
<ul>
<li><label class="highlight"><input type="checkbox" id="1" class="filteritem">Lorem Ipsum</label</li>
<li><label class="highlight"><input type="checkbox" id="223" class="filteritem">Lorem Ipsum</label</li>
<li><label class="highlight"><input type="checkbox" id="32" class="filteritem">Lorem Ipsum</label</li>
<li><label class="highlight"><input type="checkbox" id="42" class="filteritem">Lorem Ipsum</label</li>
<li><label class="highlight"><input type="checkbox" id="54" class="filteritem">Lorem Ipsum</label</li>
</ul>
<ul>
<li><label class="highlight"><input type="checkbox" id="43" class="filteritem">Lorem Ipsum</label</li>
<li><label class="highlight"><input type="checkbox" id="343" class="filteritem">Lorem Ipsum</label</li>
<li><label class="highlight"><input type="checkbox" id="342" class="filteritem">Lorem Ipsum</label</li>
<li><label class="highlight"><input type="checkbox" id="53" class="filteritem">Lorem Ipsum</label</li>
<li><label class="highlight"><input type="checkbox" id="55" class="filteritem">Lorem Ipsum</label</li>
</ul>
Run Code Online (Sandbox Code Playgroud)
每个复选框都有一个唯一的ID
我想在checkt时切换标签的背景颜色.
这是我得到的,但它不起作用:
jQuery的:
$(".filteritem").click(function(){
$(this).toggleClass('highlight');
});
Run Code Online (Sandbox Code Playgroud)
CSS:
.highlight {
//change something
}
Run Code Online (Sandbox Code Playgroud) 如何将文件输入类型与复选框链接?
这是我到目前为止:
<input type="file" name="file_upload[0]" /> <input type="checkbox" name="checkbox[0]"> checkbox 1 <br />
<input type="file" name="file_upload[1]" /> <input type="checkbox" name="checkbox[1]"> checkbox 2 <br />
<input type="file" name="file_upload[2]" /> <input type="checkbox" name="checkbox[2]"> checkbox 3 <br />
<input type="file" name="file_upload[3]" /> <input type="checkbox" name="checkbox[3]"> checkbox 4 <br />
Run Code Online (Sandbox Code Playgroud)
现在我需要在上传文件时检查PHP,检查对应的复选框(最好是循环),但我无法使其工作.
这就是我在PHP中所拥有的:
if (isset($_FILES['file_upload[1]']) && isset($_FILES['checkbox[1]'])) {
//do something
} else {
//do something else
}
Run Code Online (Sandbox Code Playgroud) 可能重复:
使用jQuery控制HTML5 <audio>卷
我有一个HTML音频标签:
<audio class="audio" autoplay="autoplay" controls="controls" src="All_Right.mp3"></audio>
Run Code Online (Sandbox Code Playgroud)
如果尝试使用Javascript设置音量,请执行以下操作:
$('.audio').volume = 0.1;
alert($('.audio').volume);
Run Code Online (Sandbox Code Playgroud)
但这不起作用.
我有3个单独的数组,我想转换为一个二维数组,所以我可以用它为D3.js
我拥有的数组示例:
var data1 = [ 0.10, 0.09, 0.08, 0.07, 0.06, ... ]; // series 1
var data2 = [ 0.10, 0.09, 0.08, 0.07, 0.06, ... ]; // series 2
var data3 = [ 0.10, 0.09, 0.08, 0.07, 0.06, ... ]; // series 3
Run Code Online (Sandbox Code Playgroud)
我想要的是:
var data = [
[ 0.10, 0.09, 0.08, 0.07, 0.06, ... ], // series 1
[ 0.10, 0.09, 0.08, 0.07, 0.06, ... ], // series 2
[ 0.10, 0.09, 0.08, 0.07, 0.06, ... ] // …Run Code Online (Sandbox Code Playgroud)