开发者

jQuery Attribute Usage for Target

开发者 https://www.devze.com 2022-12-22 01:35 出处:网络
Can anyone see why the following c开发者_开发技巧ode is not causing my url top open up in a new window, i.e:

Can anyone see why the following c开发者_开发技巧ode is not causing my url top open up in a new window, i.e:

        $(location).attr({
            href: toLoad,
            target: "_blank"
        });

where toLoad is my url.

Looking at the view source, all seems fine and basically looks like:

<a target="_blank" title="" href="http://......etc">ccc</a>

Any ideas what I could be doing wrong?

Thanks.


The jQuery wrapper is used for DOM elements, not arbitrary objects, and location (window.location) doesn't even have a target attribute. Simply do a window.open(...).

0

精彩评论

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