以下jquery 1.3.2代码有效:
<input type="select" value="236434" id="ixd" name='ixd' />
<script>
console.log( $('#ixd') );
console.log( $("input[name='ixd']") );
</script>
Run Code Online (Sandbox Code Playgroud)
控制台显示:
[输入#ixd 236434]
[输入#ixd 236434]
但是,将输入设置为"隐藏"会阻止选择器工作.有线索吗?
<input type="hidden" value="236434" id="ixd" name='ixd' />
<script>
console.log( $('#ixd') );
console.log( $("input[name='ixd']") );
</script>
Run Code Online (Sandbox Code Playgroud)
控制台显示:
[]
[]
我试图了解jQTouch实现的CSS效果.http://www.jqtouch.com/
它有一些包含语法的CSS定义 body > *
body > * {
-webkit-backface-visibility: hidden;
-webkit-box-sizing: border-box;
display: none;
position: absolute;
left: 0;
width: 100%;
-webkit-transform: translate3d(0,0,0) rotate(0) scale(1);
min-height: 420px !important;
}
body.fullscreen > * {
min-height: 460px !important;
}
body.fullscreen.black-translucent > * {
min-height: 480px !important;
}
body.landscape > * {
min-height: 320px;
}
body > .current {
display: block !important;
}
Run Code Online (Sandbox Code Playgroud)
我已经搜索了一段时间,但找不到任何提示.有人可以向我解释一下吗?
这是否意味着动画?
我有一些我可以用.click()函数选择的元素,它们会突出显示.上面有菜单,有一些动作.我想点击任何元素而不是菜单时取消突出显示.
结构体:
<body>
<div id="menu">
</div>
<div id="elements">
/* selectable elements here */
</div>
</body>
Run Code Online (Sandbox Code Playgroud)
可执行示例
$().ready(function(){
$("#elements a").click(function(){
$(this).css('color', 'red');
return false;
});
$(document).click(function(e) {
if ( $(e.target).closest('#menu').length === 0 ) {
$("#elements a").css('color', 'blue');
}
});
});
Run Code Online (Sandbox Code Playgroud)
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id="menu">
<a href="#">Menu 1</a>
<a href="#">Menu 2</a>
<a href="#">Menu 3</a>
</div>
<div id="elements">
<a href="#">Element 1</a>
<a href="#">Element 2</a>
<a href="#">Element 3</a>
</div>
<div>
Click any element to highlight it. Click anywhere to reset highlighting. Click menu to …
Run Code Online (Sandbox Code Playgroud)我有以下标记:
<div class="c1">
<div class="c2">
<div class="c3">
<input>
<textarea></textarea>
</div>
<input>
<textarea></textarea>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
我想匹配只有一个CSS规则的input
和textarea
元素div.c3
.我正在使用
div.c1 .c2 .c3 input,textarea { border: 1px solid #f00; }
Run Code Online (Sandbox Code Playgroud)
但这匹配所有textareas,而不仅仅是在c3
div中的一个cotnained .
这是可能的,还是我必须为每个元素编写单独的CSS选择器?
请查看http://jsfiddle.net/Bp3qn/1/以获取实例.
我更新了http://jsfiddle.net/Bp3qn/3/
我只需要突出显示c1-> c2-> c3容器中包含的输入和textarea,而不是其他组合.
我正在研究一个jQuery主题,其中包括尽可能多的表单元素的样式.最初它是为Webkit(Chrome)开发的.现在我想让它也适用于Firefox.
问题是; Firefox在某些特定于Webkit的语法方面存在问题.
例如:
input[type="range"]::-webkit-slider-thumb,
input[type=radio],
input[type=checkbox] {
-webkit-appearance: none !important;
-moz-appearance: none;
width: 1.2em;
height: 1.2em;
border: 1px solid black;
background: #666666 url(images/ui-bg_highlight-soft_50_666666_1x100.png) 50% 50% repeat-x;
}
Run Code Online (Sandbox Code Playgroud)
问题是input[type="range"]::-webkit-slider-thumb,
有点.删除它,Firefox工作正常.它也可以用于其他语法::-webkit-file-upload-button
,::selection
以及使用::-webkit-...
标签的所有其他内容.它识别它自己的::-moz-...
标签,::-moz-selection
虽然很好.
Webkit似乎只是忽略了::-moz-
标签.
是否有任何方便的方法使Firefox忽略::-webkit-...
标签或以其他方式处理此问题而无需维护每个CSS块的多个副本?
使用最新版本的Chrome和Firefox.
如何在shadow DOM中选择节点?请考虑以下示例:
"没有阴影"的DOM的结构
<app-element>
#shadow-root
<h2></h2>
<content>
#outside shadow
<h2></h2>
</content>
<ui-button>
#shadow-root
<h2></h2>
</ui-button>
</app-element>
Run Code Online (Sandbox Code Playgroud)
的index.html
<body>
<app-element>
<!-- OK: querySelect('app-element').querySelect('h2') -->
<!-- OK: querySelect('app-element h2') -->
<!-- There is no problem to select it -->
<h2>app-element > content > h2</h2>
</app-element>
</body>
Run Code Online (Sandbox Code Playgroud)
templates.html
<polymer-element name="ui-button" noscript>
<template>
<!-- FAIL: querySelect('app-element::shadow ui-button::shadow h2') -->
<h2>app-element > ui-button > h2</h2>
</template>
</polymer-element>
<polymer-element name="app-element" noscript>
<template>
<!-- FAIL: querySelect('app-element::shadow').querySelect('h2') -->
<!-- FAIL: querySelect('app-element::shadow h2') -->
<!-- FAIL: querySelect('app-element').shadowRoot.querySelect('h2') -->
<h2>app-element …
Run Code Online (Sandbox Code Playgroud) 我正在尝试设置图像视图的背景颜色.
<ImageView
android:id="@+id/my_image"
android:src="@drawable/my_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:clickable="true"
android:layout_alignParentLeft="true"
android:background="@drawable/selector_image_view" />
Run Code Online (Sandbox Code Playgroud)
我正在使用以下选择器.
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_selected="true" android:background="@color/Violet" />
<item android:state_pressed="true" android:background="@color/red" />
<item android:background="@color/white" />
</selector>
Run Code Online (Sandbox Code Playgroud)
但是,如果我尝试使用带有运行时异常的选择器,它会崩溃.我究竟做错了什么?
我的logcat
E/AndroidRuntime( 4196): FATAL EXCEPTION: main
E/AndroidRuntime( 4196): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.X.XCamera/com.X.XCamera.XCameraActivity}: android.view.InflateException: Binary XML file line #13: Error inflating class <unknown>
E/AndroidRuntime( 4196): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
E/AndroidRuntime( 4196): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
E/AndroidRuntime( 4196): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
E/AndroidRuntime( 4196): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
E/AndroidRuntime( 4196): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 4196): at android.os.Looper.loop(Looper.java:123)
E/AndroidRuntime( 4196): …
Run Code Online (Sandbox Code Playgroud) 可能重复:
如何跳过第一个孩子?
我有ul
4个li
:
<div id="someid">
<ul>
<li>1st</li>
<li>2nd</li>
<li>3rd</li>
<li>4th</li>
</ul>
</div>
Run Code Online (Sandbox Code Playgroud)
我正在为这些li
元素设置样式:
#someid ul li{
font-weight: bold;
}
Run Code Online (Sandbox Code Playgroud)
现在我要排除第一个li
.我该怎么做?
是否有文本过滤器或javascript/jquery函数,它会在样式表中添加所有css选择器?我试图用twitter bootstrap影响一个div,但是它影响了它之外的侧边栏,无论如何要做到这一点?(我不想使用iframe.)
编辑:
我想要的是,能够为ID文件中的每个选择器添加ID"#content".
<a href="javascript:void(0)" class="PrmryBtnMed"
id = "VERYLONGTEXT"
onclick="$(this).parents('form').submit(); return false;"><span>Dispatch to this address</span></a>
Run Code Online (Sandbox Code Playgroud)
我一直在用
var inPage = document.documentElement.innerHTML.indexOf('text to search') > 0,
el = document.querySelector(".PrmryBtnMed");
if (inPage && el) el.click();
Run Code Online (Sandbox Code Playgroud)
但是现在,类名已经改变了:类名中有一个空格和一些新文本:
<a href="javascript:void(0)" class="PrmryBtnMed ApricotWheat"
id = "VERYLONGTEXT"
onclick="ApricotWheat(this); return false;"><span>Dispatch to this address</span></a>
Run Code Online (Sandbox Code Playgroud)
我怎样才能el = document.querySelector(".PrmryBtnMed");
找到合适的班级?
我尝试使用el = document.querySelector(".PrmryBtnMed.ApricotWheat");
但是没有用.
接下来,我尝试添加一个空格(并使用反斜杠转义):el = document.querySelector(".PrmryBtnMed\ ApricotWheat");
但这也不起作用.
所以,我想知道我是否可以%20
用于空间..但没有运气.
我非常感谢你的帮助!我究竟做错了什么?
css-selectors ×10
css ×5
javascript ×3
jquery ×3
android ×1
background ×1
click ×1
colors ×1
dart ×1
dart-polymer ×1
element ×1
firefox ×1
forms ×1
hidden ×1
html ×1
polymer ×1
regex ×1
shadow-dom ×1
webkit ×1