Show Hide Multiple Divs Based On One Div And Search Text?

Jun 14, 2011

I am going to achieve something like this.

<div id="sidebar">
<div id="html1"><h2>Test 1</h2></div>
<div id="html2"><h2>a1 tes2</h2></div>
<div id="html3"><h2>a2 tes3</h2></div>
</div>

The thing is that first I need to detect if the div id is "sidebar" if its "sidebar" then it will pickup all the text inside h2 tag and will search for a1 or a2 in the text.If a1 is found then it will pickup the id html2 and make this div only visible.So in this case it will pickup id html2 and make it visible while other ids like html1 and html3 will be hidden.

View 2 Replies


ADVERTISEMENT

Show / Hide Content Of Sub Divs Based On Whether Input Is != / =

Aug 9, 2009

how can I show / hide the content of sub divs based on whether the input is != or = and be able to repeat this.I tried to hide the sub divs using , onclick if bla bla = '' ;document.getElementById('hideme').innerHTML = ''; which works, but once I try to enter a new input, then nothing happens, even if the content of the sub divs is = input.

View 2 Replies View Related

Show / Hide Divs Based On POST Value Sent From Another Page

Apr 26, 2011

The two page sections you see on the page "One Time Gift" or "Monthly Subscription" are normally hidden via a document.write via a body onload. Generally, all of this functions well. But, I want to expand the use a bit here so I want to pass a $_POST value to this page from another page which hides or shows these two sections based on this passed value. So, if the value in "once", I want the div with the id="onetime" to be visible and the other div to be hidden. If the value is "monthly", then the opposite would happen. Now this is supposed to all happen as the page loads because we are just arrivng here from the sending page.

View 9 Replies View Related

Show / Hide Divs Based On Radio Input

Mar 25, 2010

I'm having some issues with showing / hiding divs in a form based on radio button input. I'm fairly new to JavaScript so I'm still not 100% on what I'm doing... I have a pretty extensive form with quite a few container divs that are set initially to "display: none" and I need them to be set to "display:block" dependent on radio button input.

For this piece, I need the div with id "SFSCPROJSPONCOMP" to be displayed when the user selects the Radio button with name "PROJSPON" and value "COMP".If someone could provide me with JS code for that example, I can get through the rest of this form with ease.

View 2 Replies View Related

JQuery :: Hide/show Divs Based On Form Parameters

Jun 13, 2009

I'm trying to selectively hide and show divs based on what a user specifies using three select boxes in a form. I'm probably missing something obvious, but here's what I've got and it doesn't, work, they divs just stay hidden.

<html>
<head>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript">

[Code].....

View 2 Replies View Related

Show/Hide Toggle On Multiple Divs?

Oct 24, 2010

On the homepage of my site, I would like to have some nav links that toggle between a few divs that are below in the content The divs in the content should display one at a time. For example, if you click nav1, the user would see div1. If nav2 is then clicked, div1 would hide and div2 would display.

I have some code that will do this, but for some reason it is hiding any divs that are within the toggled div. I'm very basic with JS and could use some help here. Here is my code:

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"></script>
<script type="text/javascript">
function toggleID(IDS) {
var area = document.getElementById('secondContent');
var sel = area.getElementsByTagName('div');

[Code]...

View 1 Replies View Related

Script To Show & Hide Multiple Divs?

Jul 6, 2011

I found the following script online to show/hide a login div.

<script language="JavaScript" type="text/javascript">
function login(showhide){
if(showhide == "show"){
document.getElementById('popupbox').style.visibility="visible";
}else if(showhide == "hide"){

[Code]...

It works really well but I have other div I would also like to show/hide. Is it possible to have a variable in the function that I could pass the name of the div to show/hide.

I have a ul list that I am using for a navigation menu and I would like to be able to click on items in the list to show different div's. I assume this is possible, so could someone please give me an indication of how to do it as I have been trying for a few days now and no joy.

View 5 Replies View Related

Multiple DIVs Toggle Show/Hide?

Dec 7, 2010

Complete JS first timer here, hope you all can understand my difficulties and stupidities without getting too frustrated. Trying to make a portfolio website as a Christmas gift. Anyway, I'm trying to build a menu that:

1. Expands/Retracts when clicking on other 'headers' in the Menu.
2. Allows for more than one object to be listed in each 'header'.

(Something similar to this [URl]... I've tried to hatch together several online solutions but I really have no idea what I'm doing, as you can see:

[Code]...

View 1 Replies View Related

Multiple Dropdowns With Show / Hide DIVs

Aug 11, 2010

I am using the following code to show / hide form elements within a div based upon the drop down choice. How this code can be amended to use multiple drop downs within one form?


HTML Code:
<html><head>
<title>Show and Hide</title>
<script>
// Function that Shows an HTML element
function showDiv(divID){
var div = document.getElementById(divID);
div.style.display = ""; //display div
}

// Function that Hides an HTML element
function hideDiv(divID){
var div = document.getElementById(divID);
div.style.display = "none"; // hide
} .....

View 6 Replies View Related

JQuery :: Show/Hide Divs For Multiple Selects?

Mar 25, 2011

I have a jquery function that will show or hide a div id="hide1" based on the result of a select id="ticket1"

$(document).ready(function(){
$('#hide1').hide();
$('#ticket1').change(function(){
if(this.value == 'adult'){$('#hide1').hide();}

[Code]....

It works well! But my script actually clones elements of the form so a user could be selecting adult or child for a number of tickets - ticket1,ticket2,ticket3....

How can I adapt that script so that it will show/hide for each ticket

View 4 Replies View Related

JQuery :: Show / Hide Multiple DIVs On Page?

Jul 11, 2011

I have a little issue with trying to hide / show multiple divs on my page. I am using a class name for the divs but the name is generated by a field have set in my database. So for example
<div class="General">Ttitle 1</div>
<div class="General">Ttitle 2</div>
<div class="General">Ttitle 3</div>
<!-- and my link is -->
<a href="#" class="toggle" title="General">Toggle 1</a>

And then say I have
<div class="Questions">Ttitle 1</div>
<div class="
Questions ">Ttitle 2</div>
<div class="
Questions ">Ttitle 3</div>
<!-- and my link is --><a href="#" class="toggle" title="
Questions ">Toggle 2</a>

What would be the easiest way or the best way to code out the jquery to hide / show all the divs with the same name as the links title i can do code jquery to toggle 1 div but not sure how to code it so that it will hide / show all the divs with the same class name.

View 5 Replies View Related

JQuery :: Show/hide Multiple Divs Independently?

Mar 28, 2010

Is there a way I can simplify my code below? I want to be able to have just one iteration of the code and have it automatically switch out the IDs without have to add a new bit of JavaScript with each new div that is added. Here's my Javascript:

$(document).ready(function() {
// toggles the personnel window on clicking the image/header
$('div.title'+'#one').click(function() {

[code]....

View 2 Replies View Related

JQuery :: Show Hide Multiple Divs Independently Without #ID?

Dec 5, 2009

I am new to jquery and need some help with this I have the following simplified html

[Code]...

View 2 Replies View Related

Multiple Drop Downs With Show / Hide Divs?

Aug 11, 2010

I am using the following code to show / hide form elements within a div based upon the drop down choice. Does anyone know how this code can be amended to use multiple drop downs within one form?

<html>
<head>
<title>Show and Hide</title>
<script>

[Code]...

View 1 Replies View Related

Show And Hide Multiple DIVs On Page - Add Cookies?

Jul 12, 2009

I use this script to show/hide multple divs on a page. I am trying to adding cookies to this script.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "[URL]">
<html xmlns="[URL]"><head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>Show Hide</title>
<script language=javascript type='text/javascript'>
function hideSpan(pass) {
var spans = document.getElementsByTagName('span');
for(i=0;i<spans.length;i++){
if(spans[i].id.match(pass)&&spans[i].style.visibility){
spans[i].style.visibility=spans[i].style.visibility=="hidden"?"visible":"hidden";
}}}
</script></head><body>
<span id="256a" style="visibility:hidden;" >
My content<br/>
</span><span id="256b" style="visibility:hidden;">
<br/></span>
<span id="512a" style="visibility:hidden;">
<br/></span>
<a href="javascript:hideSpan('256')">show/hide span 256</a>
<a href="javascript:hideSpan('512')">show/hide span 512</a>
</body></html>

View 3 Replies View Related

JQuery :: Hide / Show Multiple Divs From Anchor Tags?

May 3, 2011

I've got an issue with the attached file.

I have 3 buttons & 3 divs.

I would like to hide/show the relevant divs (into a container) based upon the button pressed. If no div was open, then it would simply open the relevant div, however if say div 2 was open and div 3 was pressed, div 2 would toggle closed then div 3 would toggle open.

I've got each individual div opening and closing, but I'm stuck at the next point (checking if a div is open/toggling etc).

View 5 Replies View Related

Show/hide Multiple <tr> Based On <select OnChange="?

Jul 24, 2011

Show/hide table rows via select menu choices - And I changed my Javascript up a little so that I would have an easier time remembering it.Here are the codes:

HTML

<table cellspacing="5" cellpadding="5" border="0">
<tr>
<td><strong>Request Service:</strong></td>
<td><input type="radio" value="Website Design" />

[code]....

View 4 Replies View Related

Hide & Show Divs With Different Text Msgs In The Same Place On The Screen???

Dec 7, 2005

I have a form with several different text boxes for things like dates,
numbers, etc. arranged in a table, each row has the same kind of text
boxes for data entry (10 rows probably).

I want to have a separate section above the form where I can toggle a
div containing an appropriate error message to appear after the
onchange event fires for the text box.

The thing is, I want all the divs with their different text messages to
appear in the same place and disappear from the same place above the
form instead of different places on the form or web page.

Well, they don't have to be multiple divs, but there are multiple
different error messages that should appear depending where the user is
typing...

Example: 'wrong format,' 'month must be between 1 and 12,' etc. Of
course the messages will be nicer than this.

View 5 Replies View Related

Show/Hide Text And Form Field Based On Drop Down Selection

Jul 20, 2005

I'm trying to show/hide a simple piece of text and a text field on a
form based on what choice is made from a drop down box.

<select name="dropdown" size="1">
<option selected value="">Please make a selection</option>
<option value="1">Choice 1</option>
<option value="2">Choice 2</option>
<option value="3">Choice 3</option>
<option value="4">Other</option>
</select>

i.e. if Choice 2 is selected I'd like to display a new <tr> with the
following:

<tr>
<td>New text field:</td>
<td><input name="newField" type="text size="20"></td>
</tr>

if any other choices are made, I don't want to display anything.
I've tried several onchange() functions but can't achieve what I'm
looking for.

View 6 Replies View Related

Multiple Checkboxes To Hide/show Text?

Oct 31, 2011

im trying to do a single html page with multiple checkboxes to hide/show text when checked/unchecked. I'm really bad at html but so far I have got this: The problem I have is I dont know how to add more checkboxes.

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>101st</title>

[Code]....

View 2 Replies View Related

JQuery :: Show Two Separate Divs, Hide Divs On One Click?

Aug 19, 2009

I'm looking for some javascript to work with wordpress (jQuery preferrably) that will show/hide multiple divs on one click.

I had one working but it was kinda janky because it was causing me to have two divs with the same ID on one page. No good.

Since I updated to wp2.8.3 prior to launch, it's not working. So I've decided to just try and do it right.

Here's a page: [URL]

So, what I want to happen: On page load, the first tab: "general" and it's corresponding div beneath should be showing. And the first image should be showing. The other content divs and images should be hidden. I've given the text content divs a dashed border to show their borders. When a visitor clicks "dine at home" the general div and image hide, the second content div shows, as does the second image (it's currently the identical image, but the client may change later.) Etc.

I'll be using this function on a few other pages as well.

how to adjust this javascript to work on two different IDs at once?

current code:

Code:
<script type="text/javascript" charset="utf-8">
$(function () {
var tabContainers = $('div.imgswap > div');

[Code]....

View 2 Replies View Related

JQuery :: (.) Period In Value Field - Show/hide A Div Based Based On The Selection Made Via A Dropdown

Apr 9, 2010

Im using a jQuery script to show/hide a div based based on the selection made via a dropdown.

<script type="text/javascript" src="jquery-1.3.2.min.js"></script>

The problem im having is that the value used in the dropdown lists are price values eg 10.00

Consequently jQuery seems to interprit these as css notations, meaning the code doesnt work.

View 4 Replies View Related

Show One Div & Hide Two Other Divs

Apr 12, 2010

I have 3 divs containing images floated next to each other and when clicked i want a new div to appear beneath these 3 images. Clicking on the first image i want a new div to appear beneath these 3 images. Clicking on the second image must hide all other divs and only show the content for that div.

View 7 Replies View Related

Using A Script To Show Or Hide Divs?

Jun 28, 2011

im using a script to show or hide divs

<div id="div1" style="display:none">div1</div>
<div id="div2" style="display:none">div2</div>
<a onclick="showIt('div1');">div1</a>
<a onclick="showIt('div2');">div2</a>

[Code]....

the script works fine with one problem. I would like div1 to be initially visible but if i remove the style="display:none" then the script does not function correctly.

View 1 Replies View Related

Inconsistencies Trying To Show/hide Divs With JS?

Feb 25, 2009

I'm using a pretty simple submenu to try to hide the div sections I don't want, isolating the ones I do want to be the only ones visible. My code isn't the most concise when addressing this problem, but it looks like it should still work.

Make sure you use Firefox (because I'm still very early in development and I dislike IE) and use this link [URL]... to see for yourself: Observe that there are two videos and one graphic. Hover over "my work" and click graphic. Fine, right? Now click video.

The div sections are identical in naming conventions. Is it that the JS can't act fast enough? I thought I remedied that by calling isolateDiv() after I had hid all the unwanteds.

[Code]...

This is just a small portion of my code. The sections separate fine when you first click the video link.The problem is that after you select one section, and then decide to select another one, only the first post with that div id shows up. Try the link at the top and hover on the "my work" section to try.

View 2 Replies View Related

Having 1 Dive That Hide/show All Divs?

Jun 27, 2011

is it possible to have 1 dive that hide/show all divs the div i want to open all or hide all is

<div id="expandall" onclick="toggleall('noticecontent[i]');" div style="cursor: pointer;" div align="center"> Abrir tudo</div>
<html>
<head>
<script type="text/javascript">

[code].....

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved