- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我尝试运行 jquery 但没有成功:
<script type="text/javascript">
$(function () {
var pathname = window.location.pathname;
var a = pathname.split('/');
if (a[1]^ = "login" || a[1] == "") {
$("#product").css("margin-left", "0px");
} elseif (a[1] == "admin.aspx") {
$(".pnlBreadcrumb").css("margin-left", "10px");
}
});
</script>
谁能帮助我,我哪里弄错了
谢谢
最佳答案
^
是按位异或运算符。
indexOf
方法,返回找到的字符串的位置。else if
而不是 elseif
。注意:您不必在 /
处拆分 location.pathname
属性,因为路径始终以 /
开头。只需在代码中包含斜线即可。
代码:
$(function() {
var pathname = location.pathname;
if (pathname.indexOf('/login') === 0 || pathname === '/') {
$("#product").css("margin-left", "0");
} else if (pathname === "/admin.aspx") {
$(".pnlBreadcrumb").css("margin-left", "10px");
}
});
附言。这个问题是由于对 JavaScript 的理解不好造成的。我强烈建议在使用 jQuery 之前学习 JavaScript。
关于jquery - jquery startwith 选择器问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9686957/
我试图匹配文件前缀是否与我的对象匹配,但我遇到了类转换异常 for (int i=0;i ,但在运行时它实际上包含一个 java.lang.Boolean 。由于泛型的实现方式(称为 "erasur
我有 Observable 发出一些 String: List list = // size this list is 5 Observable o1 = Observable.fromArray(l
我尝试运行 jquery 但没有成功: $(function () { var pathname = window.location.pathname; var a = path
我正在尝试使用 startWith 过滤器,但它没有正确过滤数据,就像 P 的情况一样。让我知道我在这里做错了什么。 Controller 代码 - var app = angular.module(
我对Kotlin不满意(尽管我在Java等其他语言方面有很多经验)。我试图用Kotlin编写一些代码,但不明白为什么以下代码无法编译。 private fun test(inpStr : String
自从更新到 RXJS 第 6 版后,我的 WebStorm 编辑器一直在提示 startWith() 的某些用法。该运算符被标记为已弃用。 您可以在源代码中看到这些方法被标记为已弃用: Link to
我是 Observables 和响应式(Reactive)编程 rxjs 的新手,我已将 redux-observable 库添加到我的 React/redux 应用程序中以开始使用它。 我为登录过程
以下代码仅在 observable2 完成后才从 observable1 发出项目。 observable1.startWith(observable2) .subscribe(
我有一个使用 startWith 运算符和 debounceTime 的流。我希望第一个值跳过 debounceTime 并立即开始。我该怎么做? control.valueChanges .
我正在使用 Typescript 学习 Angular 5。我正在尝试实现一个 Angular Material 自动完成功能,我发现以下代码对我来说非常晦涩: this.filteredStates
我有一个关于多播 observables 和我注意到的意外(对我而言)行为的问题。 const a = Observable.fromEvent(someDom, 'click') .map(e
我有一个 rx observable,我需要添加一个特定的项目,但前提是 observable 至少发出一个项目。 我找遍了所有的运营商,但找不到合适的。最接近的是 StartWith但根据图表,它会
请有人告诉我为什么我的 startsWith() 方法是红色的。我对 Selenium 和 Java 很陌生,非常感谢任何帮助。我使用的是 IntelliJ IDEA 社区版、Java 和 Windo
我的应用程序中有许多用于网络请求的 Observable。由于有太多相同之处,我对它们应用了 Observable 转换: /** * Creates a transformer that appl
我有以下代码。这是基于使用临时容器来选择特定项目,然后将它们添加到列表的末尾。 var allRoles = roles.Table .AsEnumerable().Select(p =
我正在使用另一个 Observable 的输入来过滤一个 Observable - 过滤的输入来自用户。 过滤是通过 RxJS 运算符combineLatest完成的。使用这个意味着当订阅这个流时,在
如果我希望订阅者最初至少获得 X,我可以对现有的 Observable 使用 startWith( X ) 吗: streamFromLibrary.startWith( X ).subscribe(
我有两个列表。两者包含相同的值: QStringList filePaths; filePaths.append("C:/backup"); filePaths.append("C:/downl
是否有任何预定义函数可以使用 Rust 的迭代器开始迭代自定义元素? 最佳答案 iteration with a custom element 如果您只有一个元素,请使用 iter::once . 如
有人知道“startWith”函数变成了什么吗? 我尝试使用一本适用于 4.x 版本的书来学习 reactivecocoa。该示例使用 startWith 为 datePicker 控件强制赋值。 最
我是一名优秀的程序员,十分优秀!