0

I encountered this question and can't figure out what is right answer for it. Help Please.

4

5 回答 5

3

其实没有一个是对的。他们正在寻找的答案可能是 (a),这意味着每个链接都有一个以 https开头的 HREF。但是由于它们不包含协议字符串,因此没有什么可以阻止它匹配类似https.wordpress.com或之类的 URL https/images/kitten.gif

于 2013-02-15T05:31:02.740 回答
1

According to the jQuery documentation, it should be option a, BUT that won't help if you are already on a page loaded by https and you have relative links.

于 2013-02-15T05:30:10.083 回答
1

This is a question about CSS and regular expressions, though it looks like a jQuery question. The trick is that RegEx's use the ^ and $ characters to indicate the beginning and ending of a line, respectively. Therefore, the ^= operator would match the beginning of the href attribute of the anchor elements, and the right answer is option a.

于 2013-02-15T05:30:48.277 回答
1

The correct answer is

$('a[href^=https]');

according to jQuery website..

Selects elements that have the specified attribute with a value beginning exactly with a given string.

jQuery( "[attribute^='value']" )
于 2013-02-15T05:30:53.267 回答
0

好的,我找到了.. 是的,正确的选项是'a'....

as '^' - 将检查初始表达式 '$' - 将检查确切的单词 https

于 2013-02-15T05:46:17.253 回答