I have a site which is rendering some CMS-driven content with empty paragraphs. I'd like to remove these spaces dynamically with jquery. I'm trying this but it doesn't work:
How to just replace all occurences of '<p> </p>' within nothing (i.e. remove them)?
I have a link and a div on a webpage. With the link I want to toggle the content (HTML) of the div. On toggle, I want to load the content from a PHP-file and I want it to load on the toggle, not when the webpage originally loaded (to reduce loading time on the webpage itself).
The file that is loaded on toggle doesn't have to be PHP, but it would help a lot.
I use a small piece of JS code to make different elements on the page show/hide when clicking a link, based on id:
function toggle( targetId ){ if (document.getElementById){ target = document.getElementById( targetId ); if (target.style.display == "none"){ target.style.display = ""; } else { target.style.display = "none"; } } } Then HTML looks like this: <a href="#" onClick="toggle('news'); return false;">Show/hide news</a> <div id="news" style="display:none">BlahBlahBlah</div>
This works. Initially the element is hidden (with style="display:none" property of the element), and the script gets its id and changes its display property to "block" when clicking on a link.
But when Javascript in a browser is turned off, the elements to show are all hidden, and there's no way to see the content of the element.
My question: is there a way to hide toggled elements on page load with JS, so that when it's turned off the hidden content is shown?
I have a menu that grabs content via ajax and json. This menu has 3 levels. I can click on the first level and it loads fine. This is the .cat class that then toggles. However when I click on the 2nd level link, the .ahref class it does not fire.
I've been trying to build my website so that the user first starts at the home page. Whenever the user clicks on the horizontal menu/navigation bar, the new content would push the home page content down. Clicking on another menu/navigation item would also push everything down and display the new content above it. I've been researching and figured i'd have to use jquery toggle. I've looked at multiple guides, and the one at
[URL]
is like what i'm trying to do. However, I can't figure out how to toggle from a horizontal navigation/menu bar instead of using HEADERS like in the example link. I don't want to toggle content with the clickable toggle button stacked vertically. (Example: Toggle button --> Content --->Toggle Button----> Content)
I have the following show/hide div function made with jQuery:
Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head>
[Code].....
It toggles perfectly, but I would like to make to which appears to overlap the underlaying content div below. Right now it just pushes down the content div when sliding out.
So here is my problem...I've been banging my head against the wall for days with this one.How do you send data through the URL to be handled by a script in page.html, where page.html processes the data and dynamically displays the data in a modal. I can get the script to execute without trying to display in a modal, but as soon as I attempt to display in a modal, all I get is the static HTML without the jquery dynamic html.I know some code should be given, but if anyone could just walk me through the logic of why static html might be shown but not the dynamic, I think i can figure it out.
What I require seems straightforward, for each image in my gallery I would like to have a unique URL, so if there are 5 images then 5 different URL's thus enabling me to toggle content relating to the particular image, the code I believe I need to change is as follows;
I'm looking for some javascript that'll toggle hidden content. As I'm not experienced in this, I want something which is cross-browser reliable - and I'm having trouble finding something suitable. Jquery has been suggested as an option... and I found something which appeared to do the job, apart from not validating as it uses a span to include the toggled content - which is a problem as I need to included block level stuff to be hidden. Also, it came as two buttons - show and hide - and I'd prefer a single button, or preferably a normal html link.
so is it really possible to have a javascript app that runs when a "go" button is clicked (ie requiring a <FORM> tag) inside a form with a "submit" button? seems so simple, can't figure it out without doing illegal nested forms.
I have an associative array that I need to loop through, allbills, however, each element in this array requires processing by the user and I need to capture the users actions on the element and then return to the next element in the list but suspend looping until I have the users desired action...
For example,
for(mybill in allbills) { GetWhatToDo(mybill); // gets the information about what user wants to do with the currentBill }
The problem is that the function "GetWhatToDo" doesn't "block" so the loop completes without waiting for the users input from GetWhatToDo...
So, my thought was I need to design things more 'event-driven' and handle things like so:
function handleABill() { mybill=GetNextBill(); GetWhatToDo(mybill); }
A "Next" button inside the popup generated by GetWhatToDo will have an onclick event that calls handleABill again...
The problem is that I can't figure out how to write GetNextBill so that it maintains the state of the loop through 'allbills', especially since 'allbills' is an associative array and I can't keep track of the array index. The only thing I can think of is to initialize a regular array from the associative array and keep track of the index number.
What I'm trying to do is create a document which allows you to select a size of box from a drop down menu, and then select a size of product to go into the box on a second drop down. The products on the second drop down menu will be allocated based on the box size that you've selected to make sure that you can only choose products which will fit in the box you've selected.
In order to do this I've set up a 2D array, which lists each product and which boxes they will fit in using 0 for no and 1 for yes. When you select a box size from the drop down a value appears in a text box next to it (1, 2, 3, or 4) and what I need to do is use the number which appears in this text box to pull data from the array to populate the next drop down list. i.e. If option 2 appears from the first drop down selection then the second drop down should be populated with data from column 2 of array (In this example 1212, 1515, and 2020 would be shown in the second drop down)
Im having trouble with the Java script to pull the values from the html text box in order to manipulate the array. If you look at the function 'top_biochill_addOption_list()' you will see that the second drop is populated here from row [itop2][3] of the array, which means the second drop down is permenantly populated as if option 3 had been selected from the first drop down. I need to get the value selected from the first drop down as a variable and replace the '3' in the above statement with that variable to get this to work but I have no idea how to go about that.
Hopefully all will become clear when you see the code. As I say, I am very new to Javascript so I'm sure this code is probably messy and inefficient, but with that in mind I'd appreciate replies being in simplified terms so I can understand what you're getting at, or if anything gets re-written then a brief explaination of whats going on would be handy so I can understand what the code is actually doing!
<html> <head> <script type="text/javascript"> var linebreak = "<br />";
I have a CSS driven zoom feature which shrinks a large image down to a specified size and when hovered over, the image enlarges to its full size. I need to be able to either make it stay opened (enlarged) when clicked, unless it is clicked to close OR to have the hovered (enlarged) image on a time delay to stay open for a specified amount of time.
I have already tried 2 scripts that I've found, but they are very over-complicated for what I need.
I thought, I'd only need to put something in the <a> tag or <img> tag, but I'm so new to Javascript and it is wearing me so out that I'm exhausted.
I did, however, get the effect that I wanted when I applied a:Active, instead of a:Hover) - It's just that can't get the image to close upon a second click.
My guess is that I need a js with an if open then onclick close it - but I'm not sure how to construct it or exactly where it wiill go.
Here is the CSS that operates the zoom (external CSS):
You will see that I have three combo box objects on this form - one containing dates (Date) and the other two containing times (Time1 & Time2). Each time on each date is an available appointment.
I would like the content of the date combos to be read from a file whenever the page is opened - a text file with one record per row would be fine (by way of an example - but this may be insufficient). On the face of it this would seem fairly rudimentary but I don't code in JavaScript of PHP and, having found this site I can make a start. I used to be a VB coder.
On each date the following appointment times are available: -
10:00 11:00 12:00 14:00 15:00
This assumes that no appointments on a given day are taken.This leads me to conclude that each date should have records for each time - possibly as a CSV text file as follows: -
"29th May 2009","10:00" "29th May 2009","11:00" "29th May 2009","12:00"
[code]...
The second time combo should make unavailable the time selected in the first time combo and present only those times available on the chosen date in the CSV file on the server.When I confirm appointments, at present I have to edit the page objects and update the web - which is quite messy and slow whereas uploading a simple text file, whilst an imperfect solution, is much better than what I currently have.
I believe that a PHP or Javascript routine based on events on the three objects would remove the inherent problems and would provide a useful set of building blocks for other routines of a similar nature.The routine would trigger whenever the page is loaded (or refreshed) or the content of any one of the three objects gets or loses the focus or a selection is made in an object.
The Date Combo would need to look up the available dates - keeping the currently selected date selected or, if that date is no longer available defaulting to the first date in the list. The user then makes a selection or makes no change to the selected date.The Time1 Combo then reads the available times for that date, retains the currently selected time (if available) or the first available time (if the selected is not available) and the user makes a selection or accepts the current selection.The Time2 Combo does the same as the Time1 Combo and in addition it eliminates the time selected in the Time1 Combo from the available choices.
The result is that visitors are only offered available times on available dates (insofar as this solution provides).When the form is submitted I would receive the email and confirm the appointment with the client and, in addition, I would modify and upload the modified data file to the web server using Filezilla. The benefit is that there is a slim to none chance of two people wanting to book the same times on the same date at exactly the same time (though it is possible). In addition, I can add new dates and add new times if there is a demand and I can even add previously deleted times if there is sufficient demand to warrant bringing in a second consultant to take the meetings.
I'm extremely new to jquery and trying to write a toggle function without using the built-in functionality. From what I've read, this should be a fairly straightforward exerciseHowever, I'm running an issue. My code doesn't seem to do anything. Not clear to me why because nothing is erroring out? Here's what I've got:
<html> <head> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript"> // we will add our javascript code here
1) Script Title: Ajax Tabs Content Script (v 2.2) and Featured Content Slider Using jQuery UI
2) Script URL (on DD): [URL]
3) Script URL of Featured Content Slider Using jQuery UI [URL]
4) Script URL of my implementation of both script. [URL]
5) Problem: I've integrated the featured content slider in one of the default content section of the tab menu as you can see on the link on point 4. The slider is working perfectly when until i click on other tab menu and then back tab menu 1. The slider seize to work no more and worst the other featured content slides are appearing below the first one.
I have previously developed two scripts, both of which work really well, however I want to amalgimate them together if possible? My first script loads the content specified into a single div, replacing the content depending on which function is called, it also displays a loading gif during a timeout of 2 seconds. Here is the page:
Most Jquery I have seen 'pushes' the content above or below it up or down the page as it reveals the hidden content, the above example reveals the content over the top without pushing out any other content which is what I am looking for I have tried to take the code and everything works aside from those tabs!! I was hoping somebody has a link to another site that does the same effect
I have content in hidden (invisible) DIV elements on a page that I want to load into another DIV element on same page. I need to replace content currently in a DIV with that coming from another DIV. DIV ontent could be a P element or a P and IMG element.
I have a page with links that use jQuery to load individual pages of content into a main content area. On one of these pages, I want to be able to link to a specific anchor. (ie, when you click the link named "exec" on the main page, it loads the "services" page and then scrolls to the "exec" div.
[Code]...
Everything works beautifully in FF and Opera but in IE, I get an error message saying "top is null or not an object". It's referencing the line where "target_offset.top" is called, but this is legitimate syntax, so I don't understand the problem.
I have a page with the code below (you can see the page herehttp://thegamingmall.com/realsite/testing.html). I'm using the .toggle() function to show/hide a div tag. However you ALWAYS need to click it twice! It's driving me and the users insane.
I'm trying to get an A tag to toggle between hide and show when It is clicked, you can check the latest version of my trying here:psdesignzone dot com / jquery / d6tftoggle.htmlI'm trying to change the innerHTML I guess of the A tag to hide or show each time that specific element is clicked (i'll need this to work with other a tags as well)