我在页面上有一个列表框,我试图查看是否选中了每个元素中的复选框。
我在框上进行了“检查”,并且一直在选中/取消选中该框以查找DOM中的更改。我唯一看到的区别是,如果选中了一个复选框,则 def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
def keystorePropertiesFile = rootProject.file("key.properties")
def keystoreProperties = new Properties()
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
android {
compileSdkVersion 28
lintOptions {
disable 'InvalidPackage'
}
dexOptions {
javaMaxHeapSize '4g'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "*********"
minSdkVersion 18
targetSdkVersion 28
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile file(keystoreProperties['storeFile'])
storePassword keystoreProperties['storePassword']
}
}
buildTypes {
release {
signingConfig signingConfigs.debug
minifyEnabled true
useProguard true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
flutter {
source '../..'
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.google.firebase:firebase-core:16.0.7'
implementation 'com.google.android.gms:play-services-ads:17.2.0'
}
apply plugin: 'com.google.gms.google-services'
会出现/消失。
在选中此框之前:
::after
选中此框后:
<div class="member-select fit-additional-content">
<input type="checkbox" class="select-member small-input" id="select-9804342" value="9804342" dir="ltr">
<label data-tracking-control-name="selectProfileCheckbox" for="select-9804342">
::before
<span class="hide-a11y">Select Erwin Tam</span>
</label>
</div>
我想念什么吗?这似乎不正确。我希望页面上有一些类名或元素可以更改,以告知DOM已选中一个框。
我可以使用jquery选择器检测到<div class="member-select fit-additional-content">
<input type="checkbox" class="select-member small-input" id="select-9804342" value="9804342" dir="ltr">
<label data-tracking-control-name="selectProfileCheckbox" for="select-9804342">
::before
<span class="hide-a11y">Select Erwin Tam</span>
::after
</label>
</div>
的存在吗?我还能去哪里找?
答案 0 :(得分:0)
使用
$('#select-9804342').is(':checked')
要查看是否已选中此特定复选框(您也可以使用其他选择器代替ID select-9804342
)。如果选中,它将返回true
,否则返回false
。
::after
的存在/消失仅与CSS /样式有关。与复选框的实际状态无关。