href

Deactivate link with DOM click event

This question is mainly out of curiosity (I have a different working solution to the issue). Trying to do some basic progressive enhancement: a table should have each row clickable to go to another page using JavaScript. For people w/out JavaScript, there's a link in the first column of each row. If JavaScript is enabled, the links shoul...

Converting "document.getElementById" into jQuery.

I've been thinking/searching for an equivalent of the problem that I am having below, and nothing could be found. Is there a way I can rewrite this to work with jQuery as an alternative? First half of the code. <a href="link.php?test=true" onclick="request(this)" target="_blank"> <a id="step2" href="javascript:alert('NOT FINISHED!');...

Changing the value of "id=" with document.getElementById

Is this the correct way to do it? <a id="load" href="#" class="btn load" onclick="request(this); $('#load').fadeOut(2000)">add</a> <a href="#" id="test" onClick="alert( 'TEST!' )">here</a> <script language="javascript"> var requests = 2; function request(self) {if(self.href != "#") requests -= 1; if(requests === 0) document.getEleme...

Javascript add ID to HTML href.

Hi everyone, I have a livesearch script that i need to populate my html menu with information. i have a menu how looks something like this: <a href="?page=page&id=">Menu item</a> what i'm looking for is a piece of code that would do this to the link: <a href="?page=page&id=1">Menu item</a> i have a Javascript that pulls out value ...

How to change behavior of <a href="somewhere.html" id="link"> with jQuery?

For those with javascript enabled,click on them should do OnClick() For those with javascript disabled,click on them should just go to somewhere.html, Suppose only $('#link') is accessible,how to do that? ...

How can I open a new tab or window when a link is clicked?

I have same ancors/hyperlink in my html file. These point to a new website outside my site. So I want that when the user clicks the link it should open a new tab or window. My website page should not be closed. How can it be done? ...

how do i count Href using jquery

hi all, I want to count the Href in a page using Jquery . Just for refrence: i have random number of hyperlinks in a page for each user and all hrefs are diffrentiated with thier id eg. user_1,user_2,.... so here im unable to call the function on onclick event using Jquery since each href is has different name and cannot also write s...

AJAX change page content

I have used AJAX to successfully change the content of a web page. I can include another web page from my domain but the problem I have is making the hyperlinks to work. If the hyperlinks use relative addressing then that will not work relative to the page I am including it in so I was investigating php to parse the html tag as I read i...

How to get "raw" href contents in JavaScript

I am trying to write a GreaseMonkey script in which I want to find all of the links that are relative links. It seemed to me that the way to do that would be to match the contents of href against /^https?:///. But I find that when I access the anchor's href attribute, it's always normalized or cooked into a form that contains "http". ...

to remove href attr from all the anchor tags using Reg Ex

i am trying to remove href attr from all the anchor tags using Reg Ex,for print page. Although i need the text value in anchors. ...

Wrong extraction of .attr("href") in IE7 vs all other browsers?

Can it really be true that the attr("href") command for a link is handled very different in IE7 in comparison to all other browsers? Let's say I have a page at http://example.com/page.html and I have this HTML: <a href="#someAnchor" class="lnkTest">Link text</a> and this jQuery: var strHref = $(".lnkTest").attr("href"); Then in IE...

PNG losses transparency when used as a link.

I have an image over a table that has been style with CSS. When I have my image on the table without a href it is fine, once I apply an href the transparency is no longer working. Any way around this? Table css table.list_data { background-color:#F3F3F3; border:1px outset #A1A1A1; border-collapse:collapse; border-spacing:2px; font-fami...

How to use jQuery click event to change href value asyncronously, based on a JSON query

I'm using the bit.ly url shortening service to shorten certain url's being sent to a "share on twitter" function. I'd like to load the bit.ly url only when a user actually presses the share button (due to bit.ly's max 5 parallel reqs limitation). Bit.ly's REST API returns a JSON callback with the shortened url, which makes the whole scen...

RegEx on 'href' tags

I'm trying to run a regular expression on some href tags using javascript. Unfortunatly reverse possitive lookup doesn't work in javascript :-( I want to prefix all the relative tags with their full path. I am using this regex-replace patern ([hs]r[ce]f?)[\s]?=[\s\"\']?(?!http|\/)(.*?)[\s\"\'] <Sorry, as I'm unable to post my HTML sa...

HTML/JavaScript Linking

This question may have been asked before, but I had trouble finding an answer, since I didn't quite know what search terms to use. In HTML, how do you make a link go a place, but execute JavaScript instead when it is clicked? Right now, I have a link that's somewhat like this: <a href="#" onclick="javascript:dostuff()">Stuff</a> But,...

Javascript selecting option from a select dropdown, using a href.

Hello, Im working on a CMS website that creates form elements on the fly according to id and values. I need to select certain information out of these forms using a link. For radio options and checkbox options I use this code: <a href="#" onclick="document.getElementById('RAL1').checked=true">1001</a> Which works fine. RAL1 is the id o...

Setting href link target without reloading page

I have a href tag <a href="#somepage" target="sometarget"> or more accurately loading a URL from Flash loadURL('#somepage', 'sometarget'). I have no option to remove the target so am limited to (I assume) the available targets: _top, _self, _blank, _parent. What target or alternative do I have to avoid refreshing the page? ...

How to remove "href" with Jquery?

<a id="a$id" onclick="check($id,1)" href="javascript:void(0)" class="black">Qualify</a> After "href" is removed, is "Qualify" still clickable? ...

i need to build my url in a javascript function then return the string back to href

Hi, I need to call a Javascript function from an a element.. something like this: href='javascript:myjavascriptfunction();'. I need the Javascript function to get the values from a couple of datepicker controls, build and urlencode a querystring and return it so that it opens into a new window. So far I think I have everything, but I'm ...

Calling href from JavaScript

I'm developing a script for Greasemonkey, but I'm stuck trying to activate links via JavaScript. The script should check the web page for a certain href link and, after finding it, it must activate it (like clicking on the link). If it helps, the href I'd like to activate is a "javascript:FUNCTION" kind of link. ...