这个问题有很多答案,但这些答案都没有解决我的问题.我有一个带有一些<select>标签的模态.我试图保存值select options.在他们点击后Save,模态应该关闭但不是submit结果,因为用户在点击save模态后仍需要查看内容.
HTML
<!-- Modal -->
<div id="1" class="modal fade" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">× </button>
<h4 class="modal-title">Modal Header</h4>
</div>
<div class="modal-body">
//select tags go here
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button id="save" onclick="save()" class="btn btn-width bkgrnd-cyan save-details" type="button" name="save-details">Save</button>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
JS
$('#save').click(function() {
$('#1').modal('hide');
});
Run Code Online (Sandbox Code Playgroud)
由于我的代码很长,我只是从谷歌复制了一个模态,但我添加了我的Save按钮,所以这是Save我的模态正在使用的真实按钮.
谢谢
编辑
我将id号更改为字母,所以现在代码不包含任何以number开头的id,谢谢.
PS还需要帮助= /
编辑 …
我正在创建一个显示WordPress帖子的Android应用程序.目前,该应用程序正在显示标题和副标题(3行文字)但是,它没有显示特色图像.我也很想得到作者的图像(如果可能的话),但我更担心特色图像.我试图谷歌,但我可能会问错误的问题.我也试图获得图像路径,但它根本不起作用.根据JSON特色图片包含一个id,这个id可以用来获取路径.但是,没有运气.
RecycleViewAdapter.java
package com.myfitbytes;
import android.content.Context;
import android.content.Intent;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import java.util.ArrayList;
public class RecyclerViewAdapter extends RecyclerView.Adapter {
private ArrayList<Model> dataset;
private Context mContext;
public RecyclerViewAdapter(ArrayList<Model> mlist, Context context) {
this.dataset = mlist;
this.mContext = context;
}
public static class ImageTypeViewHolder extends RecyclerView.ViewHolder{
TextView title, subtitle;
ImageView imageView;
public ImageTypeViewHolder(View itemView) {
super(itemView);
this.title = (TextView) itemView.findViewById(R.id.title);
this.subtitle = (TextView) itemView.findViewById(R.id.subtitle);
//at the moment, it is displaying an …Run Code Online (Sandbox Code Playgroud) 我正在努力让一些大的头衔响应.我尝试过一些东西,比如:这个链接.但它没有用.
CSS
body {
margin-top: 50px; /* Required margin for .navbar-fixed-top. Remove if using .navbar-static-top. Change if height of navigationchanges. */
}
#page-wrap {
width: 760px;
margin: 0 auto;
}
.title {
font-family: Brush Script MT,cursive;
font-size: 10vw;
font-style: normal;
font-variant: normal;
font-weight: 500;
}
#welcome {
@extend .title;
}
#to {
@extend .title;
text-align: center;
font-size: 50px;
}
#mp{
@extend .title;
text-align: right;
}
.full {
background-image: url('../img/beach-bg1920-1080.jpg');
background-repeat: no-repeat;
background-attachment: fixed;
background-position: center;
-webkit-background-size: cover;
-moz-background-size: …Run Code Online (Sandbox Code Playgroud) show()如果页面加载时选中复选框,我正在尝试创建一个表单。目前,当我刷新页面时,我的复选框确实显示已选中。但是,它不会显示,form直到您单击两次,因此,如果您单击该复选框,一旦取消选中它,然后再单击一次,该复选框就会被选中并显示表单。
另一个问题是我有 5 个复选框 ID 和 5 个表单类,所以我有 5 个函数做同样的事情。我的问题是,如何让一个函数可以使用 5 个不同的 ID?
所以,有两个问题合二为一:
1)复选框被选中时如何显示表单
2)如何将我的 5 个函数转换为一个函数,该函数根据传递的 ID 显示表单。
PS:我有
<script src="https://code.jquery.com/jquery-2.1.0.min.js"></script>
<script type="text/javascript" src="js/setting.js"></script>
Run Code Online (Sandbox Code Playgroud)
里面<head>
这是 HTML(注意:我只会发布一个div具有一个 ID 的 HTML)
//This is the checkbox
<div class="col-sm-6">
<div class="form-group">
<label class="switch">
<input name="on_off" checked type="checkbox" id="bc1" class="switch-input on-off">
<span class="switch-label" data-on="On" data-off="Off"></span> <span class="switch-handle"></span>
</label>
</div>
</div>
//this is the form
<form class="form-horizontal bc-details1" method="post" action="programs-controller.php" style="display:none" role="form">
<div class="col-sm-6">
<div class="form-group">
<label …Run Code Online (Sandbox Code Playgroud)