开发者

If URL not equal to specified URL then apply this jQuery? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 11 years ago.

if the current uURL is not same as specified then apply jQuery. BUT THIS WONT WORK

<script type="text/javascript">
var myurl = http://example.com/document.html;
var currenturl = window.location
if(myurl 开发者_如何学运维== currenturl) {
    $("<span>url's match</span>").replaceAll("body"); // check replaceWith() examples
}
</script>

Also current URL can be a standard link http://example.com/ or as shown in example.


You need to quote your URL:

var myurl = http://site.com/document.html;

// Should be
var myurl = "http://site.com/document.html";

For best practice, don't omit the ; here:

var currenturl = window.location
//---------------------------^^^^


You are missing quotes on the first line:

var myurl = "http://site.com/document.html";

And it should be != on the third line

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜