当我将鼠标悬停在导航栏中而不是链接到maleF.html
或femaleF.html
时,它会打开我的文件夹名称,正式存储我的img照片。
广播男性女性
<form style="padding-top:0px">
<input type="text" name="search" oninput="myFunction()" placeholder="Search">
<input type="radio" name="gender" value="male"> Male
<input type="radio" name="gender" value="female"> Female
</form>
导航
<div class = "dropdown" width = "10">
<button class="dropbtn">Clothing</button>
<div class="dropdown-content">
<a id="formal" href="#formal">Formal</a></br>
<a id="maleFormal" style="display:none" href="maleaF.html">Male Formal</a>
<a id="femaleFormal" style="display:none" href="formalF.html">Female Formal</a>
<a href="#tshirt">Tshirt</a></br>
<a href="#jeans">Jeans</a></br>
<a href="#skirts">Skirts</a></br>
<a href="#shorts">Shorts</a></br>
</div>
</div>
的javascript
<script>
$(document).on('click','#male',function(){ // this is to fitch male html. script
$("#formal").hide();
$("#maleFormal").hide();
$("#femaleFormal").show();
});
$(document).on('click','#female',function(){ // this is fitch female.html script
$("#formal").hide();
$("#maleaFormal").hide();
$("#femaleFormal").show();
});
</script>
答案 0 :(得分:0)
首先,请在单选按钮中添加“male”和“female”id属性:
<script>
$(document).ready(function(){
$("#male").click(function(){ // this is to fitch male html. script
$("#formal").hide();
$("#maleFormal").show();
$("#femaleFormal").hide();
});
$("#female").click(function(){ // this is fitch female.html script
$("#formal").hide();
$("#maleaFormal").hide();
$("#femaleFormal").show();
});
});
</script>
然后将您的jquery代码更改为以下内容:
public function updateProfilePicture(Request $request, Response $response, $args = []) {
$files = $request->getUploadedFiles();
if(empty($files['image'])) {
throw new AppException('Invalid image');
}
// Validate image
$validator = v::key('image', v::image());
try {
$validator->assert($files);
// $validator->assert($_FILES);
} catch(NestedValidationException $e) {
throw new AppException($e->getMessage());
}
}