在Jquery中,我只想在第二个数据列表上显示正确链接到在第一个数据列表上进行选择的某些属性的结果
我尝试了很多事情,但是我无法对第一个数据列表中所选项目的属性进行排序
第一个数据列表如下:
<input id="boxCli" name="cat1" list="cat1" placeholder="Catégorie 1">
<datalist id="cat1">
<option data-prod="100" value="Chef de Projet">Chef de Projet</option>
<option data-prod="50" value="Mécanique">Mécanique</option>
</datalist>
第二个数据列表类似:
<input id="boxCli2" class="box2" name ="cat2" list="cat2" placeholder="Catégorie 2">
<datalist id="cat2">
<option data-cat="1" value="Gestion de projet">Gestion de projet</option>
<option data-cat="1" value="Réunion / Client">Réunion / Client</option>
</datalist>
仅当第一个数据列表中的自定义属性data-prod为==到100时,我才想显示第二个数据列表
谢谢!!
答案 0 :(得分:0)
这是一个简单的解决方案,但我认为最好将JS对象与所有组合一起使用,以根据其依赖性填充数据列表
const MyForm = document.querySelector('#my-form')
, AllCat2 = document.querySelectorAll('#cat2 option')
;
MyForm.onchange =e=>{
let ON_OFF = (MyForm.cat1.value !=='Chef de Projet')
AllCat2.forEach(cO=> cO.disabled = ON_OFF )
}
<form id="my-form">
cat1 :
<input id="boxCli" name="cat1" list="cat1" placeholder="Catégorie 1">
<datalist id="cat1">
<option data-prod="100" value="Chef de Projet">Chef de Projet</option>
<option data-prod="50" value="Mécanique">Mécanique</option>
</datalist>
<br>
cat2:
<input id="boxCli2" class="box2" name ="cat2" list="cat2" placeholder="Catégorie 2">
<datalist id="cat2">
<option data-cat="1" value="Gestion de projet">Gestion de projet</option>
<option data-cat="1" value="Réunion / Client">Réunion / Client</option>
</datalist>
</form>
答案 1 :(得分:0)
在这里找到答案:Value of selected <datalist> item
进行一些修改:
StrictMode policy violation: android.os.strictmode.NonSdkApiUsedViolation: Ljava/nio/Buffer;->address:J
at android.os.StrictMode.lambda$static$1(StrictMode.java:428)
at android.os.-$$Lambda$StrictMode$lu9ekkHJ2HMz0jd3F8K8MnhenxQ.accept(Unknown Source:2)
at java.lang.Class.getDeclaredField(Native Method)
at akj.a(:com.google.android.gms.dynamite_adsdynamite@15090081@15.0.90 (100400-231259764):78)
at akj.d(:com.google.android.gms.dynamite_adsdynamite@15090081@15.0.90 (100400-231259764):76)
at akj.<clinit>(:com.google.android.gms.dynamite_adsdynamite@15090081@15.0.90 (100400-231259764):116)
at akj.a(:com.google.android.gms.dynamite_adsdynamite@15090081@15.0.90 (100400-231259764):26)
at ajd.<clinit>(:com.google.android.gms.dynamite_adsdynamite@15090081@15.0.90 (100400-231259764):2502)
at ajd.a(:com.google.android.gms.dynamite_adsdynamite@15090081@15.0.90 (100400-231259764):20)
at aio.a(:com.google.android.gms.dynamite_adsdynamite@15090081@15.0.90 (100400-231259764):26)
at ajl.a(:com.google.android.gms.dynamite_adsdynamite@15090081@15.0.90 (100400-231259764):3)
at ajl.a(:com.google.android.gms.dynamite_adsdynamite@15090081@15.0.90 (100400-231259764):8)
at ahr.a(:com.google.android.gms.dynamite_adsdynamite@15090081@15.0.90 (100400-231259764):88)
at ww.h_(:com.google.android.gms.dynamite_adsdynamite@15090081@15.0.90 (100400-231259764):23)
at tl.a(:com.google.android.gms.dynamite_adsdynamite@15090081@15.0.90 (100400-231259764):18)
at td.a(:com.google.android.gms.dynamite_adsdynamite@15090081@15.0.90 (100400-231259764):12)
at tg.handleMessage(:com.google.android.gms.dynamite_adsdynamite@15090081@15.0.90 (100400-231259764):56)
at android.os.Handler.dispatchMessage(Handler.java:106)
at xs.a(:com.google.android.gms.dynamite_adsdynamite@15090081@15.0.90 (100400-231259764):5)
at xs.dispatchMessage(:com.google.android.gms.dynamite_adsdynamite@15090081@15.0.90 (100400-231259764):4)
at android.os.Looper.loop(Looper.java:193)
at android.os.HandlerThread.run(HandlerThread.java:65)
----------
StrictMode policy violation: android.os.strictmode.NonSdkApiUsedViolation: Landroid/content/Context;->bindServiceAsUser(Landroid/content/Intent;Landroid/content/ServiceConnection;ILandroid/os/Handler;Landroid/os/UserHandle;)Z
at android.os.StrictMode.lambda$static$1(StrictMode.java:428)
at android.os.-$$Lambda$StrictMode$lu9ekkHJ2HMz0jd3F8K8MnhenxQ.accept(Unknown Source:2)
at java.lang.Class.getDeclaredMethodInternal(Native Method)
at java.lang.Class.getMethod(Class.java:2064)
at java.lang.Class.getDeclaredMethod(Class.java:2047)
at aMq.a(PG:4)
at aMK.a(PG:10)
at aMr.a(PG:50)
at cvB.<init>(PG:4)
at cuV.run(PG:9)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:193)
at android.os.HandlerThread.run(HandlerThread.java:65)
----------
StrictMode policy violation: android.os.strictmode.NonSdkApiUsedViolation: Landroid/media/AudioSystem;->getPrimaryOutputFrameCount()I
at android.os.StrictMode.lambda$static$1(StrictMode.java:428)
at android.os.-$$Lambda$StrictMode$lu9ekkHJ2HMz0jd3F8K8MnhenxQ.accept(Unknown Source:2)
at com.unity3d.player.UnityPlayer.nativeRender(Native Method)
at com.unity3d.player.UnityPlayer.c(Unknown Source:0)
at com.unity3d.player.UnityPlayer$c$1.handleMessage(Unknown Source:151)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:193)
at com.unity3d.player.UnityPlayer$c.run(Unknown Source:20)
[ 06-12 00:26:52.212 15139:15203 D/ ]
PlayerBase::PlayerBase()
[ 06-12 00:26:52.212 15139:15203 D/ ]
TrackPlayerBase::TrackPlayerBase()
----------
StrictMode policy violation: android.os.strictmode.NonSdkApiUsedViolation: Landroid/media/AudioSystem;->getPrimaryOutputSamplingRate()I
at android.os.StrictMode.lambda$static$1(StrictMode.java:428)
at android.os.-$$Lambda$StrictMode$lu9ekkHJ2HMz0jd3F8K8MnhenxQ.accept(Unknown Source:2)
at com.unity3d.player.UnityPlayer.nativeRender(Native Method)
at com.unity3d.player.UnityPlayer.c(Unknown Source:0)
at com.unity3d.player.UnityPlayer$c$1.handleMessage(Unknown Source:151)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:193)
at com.unity3d.player.UnityPlayer$c.run(Unknown Source:20)
----------
StrictMode policy violation: android.os.strictmode.NonSdkApiUsedViolation: Landroid/view/textclassifier/logging/SmartSelectionEventTracker$SelectionEvent;->selectionAction(III)Landroid/view/textclassifier/logging/SmartSelectionEventTracker$SelectionEvent;
at android.os.StrictMode.lambda$static$1(StrictMode.java:428)
at android.os.-$$Lambda$StrictMode$lu9ekkHJ2HMz0jd3F8K8MnhenxQ.accept(Unknown Source:2)
at java.lang.Class.getDeclaredMethodInternal(Native Method)
at java.lang.Class.getPublicMethodRecursive(Class.java:2075)
at java.lang.Class.getMethod(Class.java:2063)
at java.lang.Class.getMethod(Class.java:1690)
at cyw.a(PG:9)
at cyE.a(PG:12)
at org.chromium.content.browser.selection.SmartSelectionClient.<init>(PG:5)
at czl.a(Unknown Source:7)
at org.chromium.android_webview.AwContents.e(PG:243)
at org.chromium.android_webview.AwContents.d(PG:210)
at org.chromium.android_webview.AwContents.<init>(PG:81)
at vE.run(PG:15)
at aKc.a(PG:13)
at aKd.run(Unknown Source:2)
at org.chromium.base.task.PostTask.b(PG:13)
at aKc.a(PG:7)
at com.android.webview.chromium.WebViewChromiumFactoryProvider.b(PG:6)
at com.android.webview.chromium.WebViewChromium.init(PG:107)
at android.webkit.WebView.<init>(WebView.java:422)
at android.webkit.WebView.<init>(WebView.java:348)
at android.webkit.WebView.<init>(WebView.java:331)
at android.webkit.WebView.<init>(WebView.java:318)
at android.webkit.WebView.<init>(WebView.java:308)
at a.a.a.a.a.e.a.b(SourceFile:1)
at a.a.a.a.a.e.a.a(SourceFile:1)
at a.a.a.a.a.h.c.b(SourceFile:3)
at a.a.a.a.a.h.c.a(SourceFile:5)
at a.a.a.a.a.h.j.a(SourceFile:12)
at com.tappx.sdk.android.TappxInterstitial.loadAd(SourceFile:2)
at com.tappx.unity.interstitialTappx$1.run(interstitialTappx.java:39)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6718)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
谢谢!!