JQuery :: Get The Name Of An Anchor?
Jul 31, 2010
I'm starting to play with JS/JQuery and I don't know how to get the name af an anchor. I have a list of img faces and when hovering them, I want to display a random quotation
Here is the html
PHP Code:
<div id="faces">
<ul>
<li><a href="#" name="stalin"><img src="../images/img1.gif" width="50" height="58" /></a></li>
[code]....
View 2 Replies
ADVERTISEMENT
May 26, 2011
I need to get the page to reload with the anchor in the link when it is clicked in a dropdown menu. For example if I am on 'www.domain.com/about/#2' and I then click on 'www.domain.com/about/#3' the url changes but the page doesn't reload so I need the page to reload, but keep the new anchor (#3).I gave the links with anchors a class of 'reload' and tried this:
$('a.reload').click(function() {
window.location.reload();
});
View 4 Replies
View Related
Jan 9, 2010
I have a script that scans an HTML document for headers and special comment tags for the purpose of generating a left-floating/position-fixed DIV that contains the document's outline or "table of contents." Within the DIV are lists (UL element by default) whose items (LI elements) are jump-to links (A elements) to the points (headers, special points marked for inclusion in table of contents) in the document. The problem is this. I have typical HTML document with links that jump to points (usually headers) inside the document, as shown below:
Code:
<body>
<p>This is addressed <a href="#later-text">later</a> in this document
<h1><a id="later-text"></a>Header Text</h1>
<p>...
</body>
But my script, being a document outliner that finds headers in a document, inserts another anchor as a jump-to point just before the first occurrence of text in the header (inserted A element shown in red below). This somehow disables the document-coded jump anchor (shown in blue below). And it occurs in FF and IE, which suggests it is not a browser-specific issue. Why does it occur? Is there something in the HTML spec that states that two anchors to which a jump occurs are not allowed to be adjacent elements in the document?
Code:
<body>
<p>This is addressed <a href="#later-text">later</a> in this document
<h1><a id="later-text"></a><a id="jump-1"></a>Header Text</h1>
[code]....
To reproduce what I am seeing, search for the text "Why Is A Survey Done". The first occurrence is a within-document jump-to link, which should jump to a header below it. If the script execution to generate a document outline is disabled, the jump works. But if the script is executed and the document outline generated, the jump-to link does not work.
View 2 Replies
View Related
Sep 4, 2011
Having a little bit of trouble with a site I'm currently working on I'm using some AJAX for the instant g-mail/facebook style navigation, you know the kind, with no refreshes, etc. Problem is, to allow for back/forward and bookmarks, I currently use a URL that looks like:[URL].. This is fine, not a problem... The issue comes into play when I want to open up the news.html page, from my home.html page, and have it open to news item #6 (for example).
I can't add a #, because one is already being used to reference the anchor for the content div. Has anyone run into a similar problem before? If so, how did you resolve it? Can some jQuery be used to find the location of the news item div in question, on load, and scroll to it like that?
View 8 Replies
View Related
Aug 3, 2011
I have this anchor tag which is created through script [code]...
I'd like to add a title attribute to it. How would I go abouttargetingthe tag and then adding the title?
View 3 Replies
View Related
Nov 22, 2010
I have a problem with my jquery. This is my code:
jQuery(function(){
jQuery(".class1").toggle(function(){
jQuery(this).animate({ height: 250 }, 'slow');
jQuery(".class12",this).animate({ height: 250 }, 'slow');
[Code].....
So div.class1 wil animate from 100px to 250px if it's clicked. However, I couldnot click the link inside this div. Everytime i click it will be animated to 100px, and I can never get the link.
How can I keep the div.class1 open so that I can click on the link??
View 1 Replies
View Related
Dec 3, 2010
i have a problem, let me paste here a code snippet first:
<a name="Paragraph 1"></a>
<p> Paragraph1 </p>
<a name="Paragraph 2"></a>
<p> Paragraph2 </p>
<a name="Paragraph 3"></a>
<p> Paragraph3 </p>
Now i want to get the anchor name of the corresponding paragraph. For example: if i hover the paragraph 2 then it will display the name of anchor tag as "Paragraph 2". can we do this in jquery? if yes then how can we achieve this?
View 1 Replies
View Related
May 27, 2010
I have tried for hours to work this out, but with no success.
<a href="IMG_0001.jpg" rel="album" title="IMG_0001"><img src="IMG_0001.jpg" alt="IMG_0001" /></a>
<script type="text/javascript">
jQuery.noConflict();
[code]....
All I want to be able to do is use the alt attribute in the image tag instead of the title attribute in the anchor tag.
View 2 Replies
View Related
Sep 15, 2009
I have multiple <tr> tags following the below pattern:
<tr>
<td class=c1Top>
<table>
<tbody>
[code]....
I need to update the href attribute so it appends the html value to the href attribute e.g.
href="http://mysite/Page1.html"
href="http://mysite/Page2.html"
href="http://mysite/Page3.html"
I tried the following, but no luck. It updates the html value of all anchor tags with the value contained in the 1st tr $('td.c1Top table tbody tr td.ms-vb a').attr('href', $('td.c1Link table tbody tr td.ms-vb a').html());
View 1 Replies
View Related
Sep 12, 2009
The first thing I'm trying to do, is pretty much exactly like the effect that is seen here [URL].. I like how it still fades even when your mouse isnt right on the link.. you could have the cursor on the link for 0.1 seconds and the fade animation still continues.. I tried looking through the sites javascript files to see how they do it, but I couldnt figure it out.
View 1 Replies
View Related
Nov 14, 2011
i have div which is display:hide, now when i click on anchor link it set display:block, now i need help with jquery to use effect when showing that div, but i need to do that without .click on that anchor.
View 3 Replies
View Related
Feb 4, 2011
I am trying to call an ajax function from the onclick event of an anchor tag. Currently I reference the function like this. I would have liked to bind the function to the anchor tag but did not know how to do that when I need to pass in a parameter?
<a href="#" onClick="getCredentialFromId(${link.id})">${link.name}</a>
link.id and link.name are rendered on the serverside so when the page is rendered it looks like this:
<a onclick="getCredentialFromId(35)" href="#">MySQL</a>
my function looks like this:
function getCredentialFromId(cred_id) {
$.post('link.htm?linkCredentials',{cred_id: cred_id},function(response) {
try {
[code]....
View 1 Replies
View Related
Jan 14, 2010
So I am creating a page with unordered lists housing a large range of numbers. I want to dynamically create anchor tags and write them in before each UL. In FireFox it works just fine, however; in IE7 the anchor tags won't work.
Here's my code:
$(document).ready(function(){
$("ul").each(function() {
var $li = $(this).find("li");
var $first = $li.filter(":first").text()
var $last = $li.filter(":last").text()
$(this).before('<a name="'+$first+'"> </a><span>' + $first + ' - ' + $last + '</span>');
$('#lists').prepend('<span><a href="'+$first+'">'+ $first +'-'+ $last +'</a> | </span>');
});
});
View 1 Replies
View Related
Nov 17, 2011
I'm working this script below that successfully selects and removes certain anchors that contain this text "d2". There are actually numerous anchors in this TD (not div) container with different (labels for the site) text strings, each anchor is followed by a comma with a space.
So I'm removing the anchors no problem (thx to jQ) - but I still need help to remove the trailing comma and associated space after each anchor I remove. My attempts at this solution are so horribly naive I won't bother posting one.
View 7 Replies
View Related
May 7, 2010
oing through my learning curve now. If I have my html (being generated by a PHP MySQL call) set up as such:
<a href="javascript:void(0);" class="clickable" opendesc="<?php print $thisid; ?>"><?php print $appname; ?></a>
so where opendesc will equal 1, 2, 3, 4...how can I pass this to jquery?I tried this:
$(document).ready(function(){
$("a.clickable").click(
function(){
[code]....
View 3 Replies
View Related
Dec 2, 2011
I have some text, where I don't want to display all of the text until the user clicks 'more' link. Once the user clicks 'more' link I want to show the div below and change the link text from 'more' to 'less' so on subsequent click the div below will collapse.
<a href="#" class="moreLink" onclick="javascript:ShowMore(this);">more</a>
<div id='completeDiv'>etc etc etc </div>
function ShowMore(object){
....show the div and
$('a.moreLink').text('less'); ---> this does not work for me.
}
View 2 Replies
View Related
Aug 29, 2010
This should be pretty simple one ,yet I can't seem to figure it out. There are posts that are similar to my question on here, but they don't really answer my questions. The a user comes to the page, they're at a URL like such: [URL]..
[Code]...
View 12 Replies
View Related
Jun 7, 2010
I am new to JQuery and trying to post some parameters from an anchor tag. But only my 'site' parameter gets passed. Here is my code :
<a class="screenshot-link" href="#" site='dv2' num='1'>1</a>
$(
".screenshot-link").click(function () {
[code]....
View 6 Replies
View Related
Aug 29, 2011
<a href="google.com" id="test"><span>0</span>The text that I actually want</a> Using JQuery I want to be able to select "The text that I actually want". $('#id').text // outputs 0The text that I actually want Is there a way to accomplish this?
View 6 Replies
View Related
Nov 8, 2010
When I use two divs one above the other using z-index then hover (using the mouse pointer) on the two divs quickly their z-index is lost and they appear one above the other ?! I face this problems in different ways when making JQuery on divs which are one above the other then move the mouse pointer above them quickly.
View 12 Replies
View Related
Sep 14, 2009
I want to use JQuery to detect when a link below is clicked.
HTML Code:
<ul id="mapoutput">
<li>
<a href="#">street=Mathew+Avesuburb=Jewellsstate=NSWpostcode=2280</a>
</li>
[Code]....
Once I have detected which link has been clicked it should pass the co-ordinates to a script.
How should I pass them? The only way i can think of it do have hidden fields whose value I pick out with javascript.
View 4 Replies
View Related
Aug 19, 2010
I used the following jQuery in my application
Code:
$(document).ready(function(){
$(".example7").colorbox({
width:"50%", height:"65%", iframe:true
});
});
Now my requirement is... I have to set this to a button but through javascript.. so... in javascript i used this as
[Code]....
View 1 Replies
View Related
Jun 24, 2009
I was wondering if someone could help me with this. I want to, when an anchor link is clicked, the id of the link is grabbed by jquery then passed to a function. The id is would be the same as the id of the div that is used for the function (highlight).
[Code]...
The code is a little messy but I am just testing right now. So if someone clicks on #aq1 link the id "aq1" is grabbed and used for the highlightFade function. It would highlight the div with id "aq1".
View 3 Replies
View Related
Dec 28, 2011
I loaded the jquery ajax file in Div id:main_content, but in another div id:List <a> tag is not working. Both Div i loaded the the content as ul,li format.
View 1 Replies
View Related
Sep 3, 2010
The following code was tested in Firefox and works also in IE 8. But when clicking the anchor (id=movefoot), it does not work in IE 7.
jQ code :
$('#movefoot').click (function (event) {
// move footer
event.preventDefault();
switch (footeropen) {
[Code].....
View 4 Replies
View Related
Dec 21, 2011
I have the following code:
function showThumbs(videos) {
for (var i = 0; i < videos.length; i++) {
var videoID = videos[i].id;
[code]....
View 1 Replies
View Related