I'm trying to replace the value of href attribute of an element with the title attribute of that same element. The code pasted below works to some extent, but the last line doesn't.
jQuery(document).ready(function(jQuery){ jQuery(".ngg-gallery-thumbnail a").each(function (arr){ if (jQuery(this).attr("alt").substr(0,5)=="Video"){ jQuery(this).attr("rel","wp-prettyPhoto");
I have an image scroller with several elements connected to it in an array. When the image goes to the next slide, the elements (title, category, desc., etc.) adjust to coincide with the new image. My issue is that I am unable to create an element (category) that pulls each "category:'current slide category'," entered in the array as a list and highlights the current slide's corresponding category.
E.g., var slides = Array( { <!--slide 1 --> url: 'images/image1.jpg', category:'category 1', title: 'This is the title of the image/article', imgLink: '#', caption: 'This briefly explains the image/article', }, { <!--slide 2 --> url: 'images/image2.jpg', category:'category 2', Title: 'this is the title of the image/article', imgLink: '#', caption: 'this briefly explains the image/article', },)
I want it to display: >> category 1 / category 2 / category 3 The corresponding slide 2 elements are active/visible in the slideshow, so whatever is entered as the category for each slide should be listed visibly (instead of the non-current items fading) and then highlighting the current one. Slideshow JS (category element on lines 309-313): [URL]
as with document.title we can get the current page title,
<body onLoad="MM_goToURL('parent','script.php?title=document.title');return document.MM_returnValue"> this is the function I've used for that above trick
function MM_goToURL() { //v3.0 var i, args=MM_goToURL.arguments; document.MM_returnValue = false; for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'"); }
I'm designing a website and I would like to add a certain class to a navigation element based on the document title. I currently have the following javascript. The nav elements have separate ids (the About Us nav element has the id="about" and so on)
<code> window.onload=function(){ var docTitle = document.title; var about = document.getElementById("about"); var advising = document.getElementById("advising")
[Code]...
The problem seems to be that the if statement is true whether or not the document.title ="about" or anything else, (if I remove the return, both about us and advising elements have their class changed.
This page: [URL] seems to indicate that it's possible, but it looks like it also pops up an alert window which would be annoying as hell. Is there a way to, say, once every minute change the title bar text?
You see I have a text file of rotating slogans that appear each time you reload a page on my site and someone suggested that having them change even when the page is already open might be fun. I thought I'd look into it and see if it's possible. The site is [URL]
I don't know enough about javascript to know if this is possible. I am fairly good at implementing and installing other people's code, though, and can usually make minor changes to tweak things.
so the story is that i using and IFRAME in my web site , and i want the main title of the document (which appears in the browser title bar) to be the title from the iframe 'page' . my English is not so good so i 'll give an example .
I am looking to use a similar method as facebook chat does, where it alternates between the original title text and 'friendsName has sent you a message!...'
At my day job, we use a cms that generates really terrible <title></title> tags that are killing our SE rankings.
Instead of taking the title of the piece of content and putting it in the title tags, it uses the name of the page template.
I first attempted this with jquery, but i'm looking for something that will basically just take <title>template name</title> and replace it with something friendlier.
New to JQuery, but making progress, not sure how to describe this issue, so stay with me. In JS I would build a function that I could call from a variety of actions, including other functions.
eg.. function dosomething(someparam){ // does something. } function dothis(){
I am trying to target all PDF document links on a website and add to the href URL. The problem is, some of the links are relative and some are absolute... Because all PDF's don't exist in the same DIR (or even in the root), how can I check for the "/" and then append? [code]which works fine if the existing URL is an absolute path (i.e. "/document.pdf") but how do I also account for those URL's that have a relative path (i.e. "document.pdf") ?? URL...
I have following jquery, which clicking a anchor link to load a content and replace the h1 to h2 tag in the loaded content before replacing a div content on current page. $('.previous-news li a').click(function() { var url = $(this).attr('href'); var link = this; $('.attachment-content').fadeOut("slow"); $.get(url, function(data) { var $fullcontent = $('#main-content', data); var html = $fullcontent.html().replace(/h1/g,"h2"); $(link).parents('.view-content').parents('.view-dom-id-2').find('.attachment .attachment-content').html(html); }); $('.attachment-content').fadeIn("slow"); return false; }); It works on firefox and webkit browsers but not in IE8 or 7. H1 tag is not replaced.
just getting started with JQ so i hope you can help me out with it Idea is that the element is a rotation of four images changing on click.basic HTML behind it is
<li><a href="#" class="puzel"><img src="images/puzel1.jpg" /></a></li> and JQ behind is currently like that $(".puzel").click(function(){
I am wanting to select a set piece of html and and replace it with another piece of html.I've used the replaceWith command but I don't think I've written the script correctly to select the piece of html as it breaks the script.
I have an OL with several LI elements. When each LI is clicked their html is replaced with a full form (multiple input types, submit button, etc). This form information is being populated from a php page using ajax.
The problem I'm running into is each time I click a form input jQuery thinks I'm clicking the LI element, which causes the ajax to fire, refreshing the form info. Essentially making it behave as if I had just lost focus.
I have used jQ to replace table rows ok. For example,
Background [what works] A page with just js, html5, jQ, css: In the current page I view, I have a table id="Tbl1', with rows of the form
n=1,2,... <tr id="Rn"> <td>...</td> <td>...</td> </tr> var rid ='#R2'; var tr is anotherr row as above with n=2; $(rid).replaceWith(tr); //will replace old row with new tr, matching the Rn. Good.
Also, I have another table id=Tbl2, in the same dom, but on a page that slides in and out using html5transition, on click. $('#Tbl2').append(tr); //works fine by appending to that Tbl2 (possiblyduplicatingrows)
[Problem] What is the exact syntax to do the $(rd).replaceWith(tr) operation on the contents of Tbl2. I have tried many combinations, but could not get it to work.
1. Looking for the syntax.
2. Incidiental question: Even though I have two tables, Tbl1, Tbl2, the first operation auto selects Tbl1 which appears second in the DOM after Tbl2.
1. Take the current URL of the page and open a new window with a URL based on the current page. Some examples (I use "->" to mean "this URL turns into that URL"):I plan to use these bookmarklets in sequence, first pressing 1 to log into the CMS, then pressing 2 to edit the current page.
What I want to do is replace a form with the submitted content. As an example, The form is submitted using the jquery.form plugin. The content is saved to the DB and a rendered comment is passed back to the client, and the success callback then replaces the form with the content. Simple enough. However, if server-side validation fails, I want to render the form, along with validation error messages, and insert that back into the client page, i.e. replace the first form with the second (which also contains the submitted content). Also straightforward, except that, on a truly successful submission, I'll need to do some other things on the page. If validation fails I only need to display the form with errors. I can think of two approaches. One is to search the returned data for some string (e.g., "<form") to decide if the other tasks are to be run.
The other is to send back the data encapsulated in a JSON object, eg: { 'status': 'FAIL', 'data': '<form ...' messages: '...' }
A client is using an analytics tracking script that needs to be updated each time the DOM is modified (ie, an element is added or removed). Basically this script allows the client to track user actions on the site (clicks, mouseovers, etc.) and, if the user is having issues, replay the entire session to help them with their problem. The issue we're running into is that this tracking script takes a cache of the DOM tree on page load, and when the DOM is updated it needs to specifically be notified that there has been a change... or else the script won't be able to see the nodes that have been added/removed.
Assuming all DOM manipulation is done using jQuery functions, is there a way to run some function every time the DOM is manipulated? I've noticed that all the DOM manipulation functions seem to run through the internal $.fn.domManip function, so I was wondering if it's possible to extend or replace this function from another JS file (assuming of course that all the manipulation functions DO in fact run through $.fn.domManip)?
Example (don't take this code seriously, it's more meant to illustrate what I'm trying to do): var oldDomManip = $.fn.domManip; //Copy the function (I know this isn't right) $.fn.domManip = function() { oldDomManip(arguments); //update the analytics program by calling it's update function here... }
I'm trying to simply replace a certain string from the contents of an element, I tried this: <div id="errorCont">Microsoft and Apple</div> var ErrorContText=$("#errorCont").html(); ErrorContText=ErrorContText.replace("Apple","No one"); $("#errorCont").html(ErrorContText); So the div SHOULD now say "Microsoft and No one", but it's not working.