anchor

Open all links in new tabs with jQuery

我只是一个虾纸丫 提交于 2019-12-01 03:14:38
I have some links that are placed in my page dynamically via JSON and have no way to directly edit them. I want to force all links to open in new tabs, ala target="_blank" Thought this would work.. but sadly it isn't. Any ideas? $('a').attr("target","_blank"); Here's a jsFiddle with the dynamic code: http://jsfiddle.net/danielredwood/mrgta/7/ You could do this (which lets the users browser decide whether to open a new window or tab) $('a').live('click', function() { window.open($(this).attr('href')); return false; }); Your problem might be one of timing. Keep in mind, when you call something

How to stop the jump when clicking on an anchor link? [duplicate]

我们两清 提交于 2019-12-01 03:06:33
This question already has an answer here: Avoid window jump to top when clicking #-links 12 answers Is there a way of avoiding the jump when clicking on an anchor link? So that the view does not change. The most semantic and meaningful approach to this problem would be to handle the onclick event from within JavaScript. Ideally this file would be best to be stored in a seperate file, however, including a in-line script within your problem file would suffice. Here's how i'd recommended approaching this problem if your already using a JavaScript library like jQuery. Assign an ID Include an id

Using anchor tag to open a mailto and invoke a URL

a 夏天 提交于 2019-12-01 02:24:24
问题 With one of my requirements i need to open up the default mailing client with invoking a call to a service, this needs to be accomplished using anchor tags or purely html, the constraint is that we can not use javascript for the same. Does anyone have any idea on how to accomplish this? 回答1: try this: <a href="mailto:test@test.com">Click to Mail</a> This will open default mailing client. Edit : You may use onClick function to open new window and call you webservice url in it.like <a href=

send $_POST data via anchor tag

淺唱寂寞╮ 提交于 2019-12-01 02:01:35
is it possible to somehow send $_POST[] data via a <a> tag? because it seems to automaticly execute the $_POST[] once the page loads rather than when I press the Anchor tag. edit: so what I'm trying to achieve is something like this: I want an anchor tag which would normaly go to somepage.php?variable=something but instead of using $_GET[] I want to send the variable via $_POST You can achieve this using jQuery and a HTML form HTML: <form method="post" name="redirect" class="redirect"> <input type="hidden" class="post" name="post" value=""> <input type="submit" style="display: none;"> </form>

Empty-linked anchor

a 夏天 提交于 2019-12-01 02:00:40
问题 I have an anchor that doesn't go anywhere but has an onclick (e.g. <a onclick="..."></a> ). My question pertains to the href attribute. What should I put for the value? If I simply omit href , the anchor doesn't have the appropriate decoration--the mouse pointer icon doesn't change when the mouse is put over it. If I use href="#" , then the window scrolls to the top of the page when the link is clicked. If I use href="javascript:..." and put the value of onclick proceeding javascript: , the

Is a link without the protocol valid XHTML? i.e. <a href=“//www.example.com/”>

扶醉桌前 提交于 2019-12-01 01:28:19
问题 Is it valid XHTML / good practice to have links of the following form? //www.example.com/foo/bar.html If the current page is HTTP, then the link points to: http://www.example.com/foo/bar.html If the current page is secured under HTTPS, then the link points to: https://www.example.com/foo/bar.html In other words, is <a href="//www.example.com/"> valid in XHTML 1.1 Strict ? And, is it supported by many/all browsers? 回答1: Is it valid XHTML Completely. XHTML doesn't care about the syntax of URIs.

Navigate to anchor on another page

梦想的初衷 提交于 2019-12-01 00:32:15
问题 I simply want to navigate from one page to a specific point on another I have a home page with four sections. <section> <a name="section1"></a> </section> <section id="section2"> </section> <section> <a name="section3"></a> </section> <section id="section4"> </section> Section 2 and 4 feature on every page, so my nav looks like: <nav> <ul> <li><a href="index.html#section1">ABOUT</a></li> <li><a href="#section2">APARTMENTS</a></li> <li><a href="index.html#section3">LANDLORDS</a></li> <li><a

anchor linking to a certain position of the page

▼魔方 西西 提交于 2019-12-01 00:03:52
I have an anchor link which links to another page. When it is clicked, by default it goes to the top of the next page. I want it brought to a certain position of the page. How do I do this (either with a jQuery slide effect or normal html)? For instance, when .sample a is clicked I want it to bring you to a certain position of the linking page. Doug Neiner OK, so this answer is very specific to your problem. The reason none of the other solutions worked is that your div elements that would match the anchor are hidden when the page loads. To prove this out, click on of your links on the home

how to make anchor tag in android clickable

♀尐吖头ヾ 提交于 2019-11-30 23:41:05
this is my code : TextView aboutL1 = (TextView) findViewById(R.id.aboutL2); aboutL1.setText(Html.fromHtml("This app is open source.<br>The source code is hosted on <a href=\"http://herp.com/derp\">Github</a> ")); Linkify.addLinks(aboutL1, Linkify.ALL); The word github appears as a link but nothing happens when I click on the link ... You need to call setMovementMethod : aboutL1.setMovementMethod(LinkMovementMethod.getInstance()); (you may not even need to call Linkify.addLinks since you used Html.fromHtml , but I can't totally remember). aboutL1.setLinksClickable(true); in XML should be

href=“#” redirects to the index page but not to the current page's top

。_饼干妹妹 提交于 2019-11-30 23:14:59
问题 Having an odd problem at the site. Link tag having href="#anything" doesn't move you to the top of the page or to the specified anchor, it moves you to the home page. That's it - when I hover over the link I see at my FF's status bar example.com/# instead of example.com/testpage.php# . Site is full of crap code and it's impossible to verify all of the settings and especially header configuration or etc. Any hints on where this might be? P.S. Link's href is not altered with JS, Firebug claims