我制作了一个带有图像的盒子,在右上角有一个X。当我单击它时,我希望它删除图像,框和X。但是什么也没发生。请不要苛刻,我是Jquery和javascript的新手。
<span class="removethis">
<div class="imformationbox1" >
<div class="col-lg-12">
<button type="button" class="deletebutton" id="" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×< /span></button>
<a href="#" id="" title="Image 2"><img src="http://placehold.it/250x250 class="thumbnail img-responsive"></a>
</div>
</div>
</span>
<script>
$( ".deletebutton" ).click(function() {
$( ".removethis" ).remove();
});
</script>
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用javascript构建一个多项选择测试,它一次显示一个问题(淡入下一个问题).在所有问题都得到解答后,根据您的答案,它会为您提供结果.实际问题的结果不需要仅显示该分数的分数和解释,因为结果将是一堆文本.
例如:
下面是我的代码,如何更改它以便没有答案是"正确的"它只是在测验结束时根据上述分数的范围给出文本结果?
使用Javascript:
(function() {
var questions = [{
question: "Question1",
choices: ["choice1", "choice2", "choice3"],
correctAnswer:0
}, {
question: "Question2",
choices: ["choice1", "choice2", "choice3"],
correctAnswer: 4
}, {
question: "Question3",
choices: ["choice1", "choice2", "choice3"],
correctAnswer: 0
}, {
question: "Question4",
choices: ["choice1", "choice2", "choice3"]
correctAnswer: 3
}, {
question: "Question5",
choices: ["choice1", "choice2", "choice3"],
correctAnswer: 4
}];
var questionCounter = 0; //Tracks question number
var selections = …Run Code Online (Sandbox Code Playgroud) 客观的
我正在尝试从 Vue 3 typescript 前端发送请求到 Symfony 5 API。使用NelmioCorsBundle该请求在 Insommia (postman) 中有效,但在 Chrome、Safari 和 Firefox 中无效。
错误
从源“http://localhost:8080”获取“https://localhost:8000/api/users/6”的访问已被 CORS 策略阻止:对预检请求的响应未通过访问控制检查:否请求的资源上存在“Access-Control-Allow-Origin”标头。如果不透明响应满足您的需求,请将请求模式设置为“no-cors”以在禁用 CORS 的情况下获取资源。
前端请求(Vue):
import { onMounted, ref } from 'vue'
import { useStore } from 'vuex'
export default {
name: 'Home',
setup () {
const message = ref('Please login...')
const store = useStore()
onMounted(async () => {
try {
const response = await fetch('https://localhost:8000/api/users/6', {
headers: { 'Content-Type': 'application/json' },
credentials: 'include'
})
console.log(response)
const user = await …Run Code Online (Sandbox Code Playgroud)