button如果未checkbox选中,我想禁用我的。checkbox应该检查至少一项以启用该按钮。
我的HTML:
<table border="1">
<tr>
<th></th>
<th>Name</th>
</tr>
@foreach($clients as $client)
<tr>
<td><input type="checkbox" name="status[]" value="$client['id']" class="checkbox"></td>
<td>{{ $client['name'] }}</td>
</tr>
@endforeach
</table>
<button type="button" id="off" class="btn btn-default" data-toggle="modal" data-target="#offer" disabled>Choose New Offer</button>
Run Code Online (Sandbox Code Playgroud)
我尝试了以下jQuery代码:
<script>
$(function() {
$('.checkbox').click(function() {
if ($(this).is(':checked')) {
$('#off').removeAttr('disabled');
} else {
$('#off').attr('disabled', 'disabled');
}
});
});
</script>
Run Code Online (Sandbox Code Playgroud)
该按钮是disabled默认设置。如果选中一个复选框,则启用它;如果未选中,则再次禁用。但是问题是当我选中多个复选框并取消选中一个复选框时,它仍然被禁用,尽管仍然选中了许多复选框。
我在Visual Studio 2013 C#中编程.我希望有一个功能可以在短时间内禁用一个按钮.我试过button.Enabled=false,但是我看到当我在它被禁用期间点击它时,点击操作就会在我在程序的其他位置启用该按钮后立即启动.
如何清除该事件或在禁用按钮时阻止它们?
此致,Krzysztof
在viewDidload方法中,我已经声明了一个按钮并设置了RightBarButton ...
let btnFavourite = UIButton(frame: CGRectMake(0,0,30,30))
btnFavourite.addTarget(self, action: "btnFavourite:", forControlEvents: .TouchUpInside)
btnFavourite.setImage(UIImage(named: "star"), forState: .Normal)
btnFavourite.setImage(UIImage(named: "star_filled"), forState: .Highlighted)
let rightButton = UIBarButtonItem(customView: btnFavourite)
self.navigationItem.setRightBarButtonItems([rightButton], animated: true)
Run Code Online (Sandbox Code Playgroud)
如何从图像'star.png'按下按钮然后更改为'star_filled.png'?然后按'star_filled.png'中的按钮到'star.png'?
如何使两个功能像
func btnFavourite()
{
//clicked the favourite button then image change to star_filled.png
}
fun btnUnfavourite()
{
//clicked the button then the bar button image change to star.png
}
Run Code Online (Sandbox Code Playgroud) 如何在开关按钮更改Android 5.1.1中的状态时删除出现的灰色圆圈(如下图所示)?
Android的开关改变状态时的效果
诺布需要再次帮助.:)
我有一个名为tblTabela的TableView和一个名为btnIzracunaj的Button.我需要的是将Button禁用属性与TableView绑定,以便在TableView没有内容时禁用Button.
当TextFields为空时,我做了与另一个Button类似的绑定,如下所示:如何在TextField为空时禁用Button?
BooleanBinding bb = new BooleanBinding() {
{
super.bind(txtPovrsina.textProperty(),
txtPrvi.textProperty(),
txtDrugi.textProperty());
}
@Override
protected boolean computeValue() {
return (txtPovrsina.getText().isEmpty()
|| txtPrvi.getText().isEmpty()
|| txtDrugi.getText().isEmpty());
}
};
btnDodaj.disableProperty().bind(bb);
Run Code Online (Sandbox Code Playgroud)
但我的问题是使用TableView,我不知道如何设置绑定属性.应该使用TableView的哪些属性?我试过这个,它没有返回错误,但也没有按预期工作.我相信getItems()应该有别的东西,但无法弄清楚是什么.:(
BooleanBinding ee = new BooleanBinding() {
{
super.bind(tblTabela.getItems());
}
@Override
protected boolean computeValue() {
return (tblTabela.getItems().isEmpty());
}
};
btnIzracunaj.disableProperty().bind(ee);
Run Code Online (Sandbox Code Playgroud)
提前致谢.
有人可以解释为什么我的链接不起作用吗?
<!-- Optional theme this one is ok -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css" integrity="sha384-fLW2N01lMqjakBkx3l/M9EahuwpSfeNvV63J5ezn3uZzapT0u7EYsXMjQV+0En5r" crossorigin="anonymous">Run Code Online (Sandbox Code Playgroud)
<button type="button" class="btn btn-primary" href="#">Get your Free Quote now!</button>Run Code Online (Sandbox Code Playgroud)
我有一个按钮,alpha设置为0.5,其可见性在布局中消失了.
<Button
android:id="@+id/Button"
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="@color/black_color"
android:alpha="0.5"
android:visibility="gone"/>
Run Code Online (Sandbox Code Playgroud)
在某些时候,我希望让它可见(Button.setVisibility(View.VISIBLE);),但是当我这样做时 - 它不是半透明的(0.5).看起来好像alpha设置为1.
我正在尝试创建Android产品布局.页脚有两个按钮,它是固定按钮.当我滚动我的布局中附带的底部两个按钮时,你可以看到图像.请帮忙我该怎么办?
图片1
图2
滚动后
XML
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/coordinate"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context="com.chivazo.chivazoandroid.activities.SingleProductActivity">
<android.support.design.widget.AppBarLayout
android:id="@+id/app_bar"
android:layout_width="match_parent"
android:layout_height="@dimen/app_bar_height"
android:fitsSystemWindows="true"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/toolbar_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
app:contentScrim="?attr/colorPrimary"
app:expandedTitleMarginBottom="30dp"
app:expandedTitleMarginEnd="64dp"
app:expandedTitleMarginStart="48dp"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<ImageView
android:id="@+id/backdrop"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:scaleType="centerCrop"
android:src="@drawable/a"
app:layout_collapseMode="parallax" />
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_collapseMode="pin"
app:popupTheme="@style/AppTheme.PopupOverlay" />
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<include layout="@layout/content_single_product" />
<LinearLayout
android:id="@+id/groupbutton"
android:weightSum="2"
android:orientation="horizontal"
android:layout_gravity="bottom"
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<android.support.v7.widget.AppCompatButton
android:layout_weight="1"
android:id="@+id/share"
android:text="share"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<android.support.v7.widget.AppCompatButton
android:layout_weight="1"
android:id="@+id/go_wishlist"
android:text="go to Wishlist"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
</android.support.design.widget.CoordinatorLayout>
Run Code Online (Sandbox Code Playgroud) 我目前在我的项目中有一个ContentPage.cs,使用Xamarin Forms作为工作环境,我只是想知道我是否能够为代码末尾的按钮添加OnClick.非常感谢任何帮助.提前致谢.
使用系统;
使用Xamarin.Forms;
namespace DebuggerTestAndroidIOS {public class VSParameters:ContentPage {public VSParameters(){Content = new StackLayout {Children = {new StackLayout {BackgroundColor = Color.FromHex("0ADF80"),Children = {
new Label { Text = PatientInformation.PatientName,
TextColor= Color.White,
FontSize = 25
}
}
},
//Patient Information Stack Layout
new StackLayout{ Orientation = StackOrientation.Horizontal,
Children = {
//Patient Image, sex and date of birth
new StackLayout{Orientation = StackOrientation.Vertical, Padding = new Thickness (30, 0, 0, 0),
Children = {
new Image {Source = "UserMale.png"},
new Label {Text = …Run Code Online (Sandbox Code Playgroud) 我正在尝试向标题中的现有按钮添加一个新按钮.我无法找到如何做到这一点.目前,我有头,下,今天,月,议程周,议程日.我想要一个按钮来添加新事件.因此,点击按钮后,我可以通过弹出添加新事件.
我的代码如下:
$('#calendar').fullCalendar({
utc: true,
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
editable: true,
droppable: true,
eventAfterRender: function(event, element, view) {
element.append(event.title);
}
});
Run Code Online (Sandbox Code Playgroud)
我的HTML代码如下: -
<html>
<head>
<meta charset='utf-8' />
<link href='fullcalendar-2.7.1/fullcalendar.css' rel='stylesheet' />
<link href='fullcalendar-2.7.1/fullcalendar.print.css' rel='stylesheet' media='print' />
<script src='fullcalendar-2.7.1/lib/moment.min.js' type='text/javascript'> </script>
<script src='fullcalendar-2.7.1/lib/jquery.min.js' type='text/javascript'></script>
<script src='fullcalendar-2.7.1/lib/jquery-ui.min.js'></script>
<script src='fullcalendar-2.7.1/lib/fullcalendar.min.js'></script>
</head>
<body>
<div id='calendar'></div>
</body>
Run Code Online (Sandbox Code Playgroud)
有没有办法通过FullCalendar完成?提前致谢..