JQuery :: Show/Hide Elements With Same Class?

May 5, 2010

oving jQuery at the moment, and have sort of hit a hiccup with showing and hiding specific elements with the same class. My idea is, what if I wanted to add a little button to show and hide the contents of a specific comment on a forum post, or blog, whatever. This would be easily done with id's but I'd like to just apply a class to each one of them and allow them to hide their contents. Here is the javascript and html as an example of what I am talking about.

[Code]...

View 2 Replies


ADVERTISEMENT

Query :: Node - Show/hide The Parent Of A Class Of Elements

Sep 30, 2010

Looking for a way to show/hide the parent of a class of elements:

Code:

But FF is giving the error message "'elP.parentNode' undefined". Something I'm not getting.

View 2 Replies View Related

JQuery :: Show / Hide Elements Or Remove / Add Elements Based On Radio Selection By User?

Mar 14, 2010

I have a page I am working and I am having some trouble with: I need to show and hide areas based on a radio selection. I initally started using the show / hide feature in Jquery but the problem is the elements need to be removed but then put back if the user selects the radio buttonagain as it has form elements that have validaion on them. The validation is still trying to validate the form elements becuase they are still on the page but just not showing. This is the radio group the user makes the selection from:

<input name="terms_usr" type="radio" id="terms_usr_1" value="1"/>
<label for="terms_usr_1">Credit Card</label>
<input type="radio" name="terms_usr" id="terms_usr_2" value="2"/>
<label for="terms_usr_2">C.O.D</label>

[Code]....

View 3 Replies View Related

Jquery :: Hide / Show Div Based On Radio Class?

Apr 18, 2010

what i have are 3 radio buttons at top of my form, the first radio option i would like if selected to open a div that contains new questions on the form... then if the other radio buttons are selected they hide that div.

View 1 Replies View Related

JQuery :: Hide And Show Elements With Same Link?

Jun 16, 2011

$('a.showContent').click(function(e) {
e.preventDefault();
$(this).each(function(i) {
$(this).parent().parent().find('.hide').slideDown();

[code]...

is also not doing it..how do I hide elements with same link that I used to show them?

View 4 Replies View Related

JQuery :: Show Lists With Less Than 2 Elements And Hide With More Than 2?

Sep 9, 2010

i've got a question. I would like to show childlists in a sidebar which have less than 2 elements in it, and hide childlists which have more 4 elements in it.this is what i got til now:

$('.sf').children('li').children('ul').length <= '2'){
$('.sf').children('li').children('ul').show();
}

but with this code, all childlists will be shown.

View 2 Replies View Related

JQuery :: Show/hide DIV Elements Depending On Select Value?

Aug 4, 2010

how one can show and hide a div element using a pulldown menu. i need the different selections in the pulldown menu to show hidden DIV elements on the page. this will be used in a system where i only have access to the template, so the only approach i can use is jquery. how to change it for the specific selectors i need.

<!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].....

View 2 Replies View Related

Show/Hide Divs By Class Name?

Aug 23, 2011

I have the situation where in the first instance I would like all divs to be visible.

Only when the user selects something in a select menu the non selected divs will hide.

I have the following:

Code:
<select name="type">
<option value="ShowAll">1</option>
<option value="Selection1">1</option>
<option value="Selection2">2</option>

[Code].....

So, if the user were to select "Selection1" two divs should only be visible. The same will apply for others, if "selection4" is made then only one div would be visible.

The user will need to the option to reset and display all divs by using the "ShowAll" selector.

I ahve seen examples of this on the net however, they do not show all the divs in the first instance and they are donhe by ID and not class. I need to do it by class as I have some with the same name and they cannot change.

View 5 Replies View Related

Show / Hide A Class With Document.getElementById?

Sep 12, 2009

I have a complex website designed with Jquerry, javaScript and css. The index.html serves as a client ui for an open source poker game. Much of the css is contained in multiple and imported external css files. The javaScript code is also contained in an external file. The site is completely functional. What I am attempting to do is add a feature to the client that will, through a JavaScript function, dynamically change the visibility element of a class.

The classes in question represent the style of the hole cards that a player sees after his cards are dealt. By default they are visible and face up. I would like to change this default behaviour by first changing their visibility element default value to hidden (easy). Then I intend to create a div with onMouseOver and onMouseOut events that will invoke the JavaScript function which will toggle the visibility element value. This will in turn show and hide the hole cards (not easy). I have attempted to use document.getElementById() but without success. After much hacking, I have the feeling that this is not the proper way of directly changing the visibility element value of a class. Here is the relevant class info (how the cards are displayed in the browser) in the external css file

[Code]...

View 7 Replies View Related

JQuery :: Show/hide Form Elements Based On Radio Button Selections ?

Mar 17, 2011

I have a set of radio buttons on my pricing page:

And a corresponding text_field input element div I'd like to display based on which radio button the user selects:

When the page loads, I'd like to see:

When the user clicks on a (different) radio button, or clicks one for the first time, I'd like whichever div is currently showing to be hidden, and the newly selected one to be shown.

Right now I have jQuery code at the bottom of my page that looks like this:

For each of the four options.

When the page loads, the correct div is shown, and when I select a new button, the new div is shown, but the already showing one isn't hidden.

I've read some posts that suggest using change() instead of click(), but others indicate that's problematic in IE.

View 1 Replies View Related

Show / Hide DIVs With Same Class Names Independently

Mar 7, 2011

I've got a PHP while loop spitting out an article title and it's content from a database and I have links to show or hide the content of the article under each title. I tried simply putting using jquery hide/show on the divs, but as you'd expect this will show and hide every div at the same time. I want to show and hide the content of the article selected as you'd expect.s!

View 9 Replies View Related

Show And Hide Elements In An Ul

Nov 4, 2006

I have some nested lists that I am trying to clean up. What I am wanting to do is to be able to click an item in the outermost list (the catagory), and have it show the appropriate inner list (the subcatagory). I have it working in FireFox, but IE is not working. Code:

View 2 Replies View Related

Hide/show Elements

Jun 11, 2005

I'm working on a form that hides/shows certain elements when certain things are selected.

In the file I'm working with, when you select the "problem" radio button, the "problem" drop down menu appears. When you select the "request" radio button, the "request" drop down menu appears

Now, when I try to make a selection from the "problem" drop down menu, nothing appears like it should (Computer, Monitor, Printer, and AVPeriph are the active ones). Everything stays hidden.

With each of those 4 selections, a table element should appear. Any ideas to what the problem is? I'm assuming it's the javascript since I don't know it too well.

View 8 Replies View Related

Show / Hide All Elements With Given Id?

Nov 5, 2010

I'm trying to figure out a small javascript question. I have certain elements in my pages that I want to show or hide if the user has javascript disabled. [code]...

View 1 Replies View Related

Hide/Show Elements With A Specific ID

Nov 6, 2007

I am trying to show/hide all the elements with a specific id ....

View 1 Replies View Related

Show Hide Page Elements?

Jan 11, 2011

I have a page that is generated using php. Below, the pdf newsletter for each month is embedded directly into the page. What I want to do is have some javascript that when the link for a month is clicked, the embedded pdf expands below and when the user clicks on another month, that newsletter is hidden then the one they clicked on gets displayed; so only one newsletter is displayed at a time.

View 3 Replies View Related

Divs Hide / Show Form Elements Showing Thru..

Sep 9, 2005

I'm doing a page w/lots of divs that I set to visibile or hidden dynamically using getElementById.. the divs are all forms... sometimes elements in a hidden form show thru on a visible form.. how can I fix this..

View 5 Replies View Related

Show/hide Multiple Elements With One Link Using Javascript

Oct 14, 2005

How can i do this i already have a function to show/hide elements with one link but how can i show/hide multiple elements

Here is the script:

function obj_ref(object)
{
if (document.getElementById)
{
return document.getElementById(object);
}
else if (document.all)
{
return eval('document.all.' + object);
}
else
{
return false;
}
}

function obj_toggle(object, open_close, open_text, close_text)
{
var object = obj_ref(object);
var icone = obj_ref(open_close);

if( !object.style )
{
return false;
}

if( object.style.display == 'none' )
{
object.style.display = ''
icone.innerHTML = close_text;
}
else
{
object.style.display = 'none'
icone.innerHTML = open_text;
}
}

View 4 Replies View Related

Prototype.js Hide/show With Variable Html Elements?

May 27, 2009

I have been staring at this problem for too long and most likely missing a simple solution so I hope somebody can take my blindfold off and show me the way The markup (which comes from a CMS and I cannot change it) I am working with is akin to:

<div id="faq">
<p><strong class="open">FAQ 1</strong></p>
<p>FAQ 1 content lorem ipsem lorem ipsem ad infinitum</p>

[code]....

Notice how the second fo 3 FAQ sections has 2 paragraphs under the 'trigger' rather than 1? Therein lies my problem, because what I am doing with prototype.js is:

1.) Loop through page and collect all <p>'s
2.) do a .each iteration and attach an onclick event on $$('p strong.open') - assume this node for each iteration is now var 'trigger'
3.) run Element.hide() on trigger.next()
4.) in the onclick event, run Element.show() for trigger.next()

- If you are still following so far - my problem is that next() only shows/hides one single element and that is the <p> holding the content - which is fine except when there are 2 or even more <p>'s with content I need to act on. I;ve experimented with nextSiblings and adjacent() and I end up with too many nodes - basically every <p> in the entire document. I just want 'hide all P's after the trigger P up until the next p > strong.open

View 3 Replies View Related

SHow / Hide Elements Based On Selected Option

Nov 13, 2010

I've tried to find a stright forward script which show/hide specific form fields based on a selected option. I've seen many online but non of them was working with me without the need of some coding or tweeks. Does anyone here have such script?

View 4 Replies View Related

Show/hide Several Elements Based On List Selection?

Jan 26, 2009

I got a table.Each row has a list of statuses.If status == yes, then several elements will be shown in the rowif status != yes, then hide those elements.Im not sure if I have made a good solution, but it seem to work ok (opera9.6, ff2, ie7)The status selector passes on a unique rowid, and itself. This way the js function can get the row, and the status of the selection. Then toggle various elements in that row.Only annoying thing is the way row elements are named and found. It kinda have to rely on some hard coding, but its ok I guess.Im not sure if its possibel to just call toggle( this ), and that way get to the elements in the row.

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

[code].....

View 7 Replies View Related

JQuery :: Toggle Function - Hide/show Table When Hide/show Button Is Pressed

Sep 12, 2011

I am trying to hide/show table when hide/show button is pressed

Problem: The code works fine when I remove 'slow' from line 10. But with 'slow' in line 10 content of toggleButton doesnt change from Hide to Show when pressed.

Code:

View 1 Replies View Related

Show/hide Elements Of A Form Based On Drop Down Box Selection

Feb 13, 2006

I am setting up a contact form, and want to have a drop down box with a handful of options. Clicking one option should display fields to input username & password, whereas all others will not. So far, I've tried and (replacing 'none with 'block' for the option that is supposed to show the input fields) but neither does what I need it to. I'm fairly new to javascript, just muddling my way through with the aid of tutorials.

View 2 Replies View Related

JQuery :: Multiple Image Buttons To Show / Hide Multiple Elements

Sep 27, 2010

I am using jquery with the cookie plugin and I have multiple image buttons that can hide/show multiple elements. My question is how can I add a cookie to this code to remember whether each separate element is opened or closed?

The code,
$(document).ready(function() {
// choose text for the show/hide link - can contain HTML (e.g. an image)
var showText='<div class="expanddown"></div>';
var hideText='<div class="expandup"></div>';
// initialise the visibility check
var is_visible = false;
// append show/hide links to the element directly preceding the element with a class of "toggle"
$('.toggle').prev().append('<a href="#" class="togglelink">'+hideText+'</a>');
// capture clicks on the toggle links
$('a.togglelink').click(function() {
// switch visibility
is_visible = !is_visible;
// change the link depending on whether the element is shown or hidden
$(this).html( (!is_visible) ? hideText : showText);
// toggle the display - uncomment the next line for a basic "accordion" style
//$('.toggle').hide();$('a.toggleLink').html(showText);
$(this).parent().next('.toggle').slideToggle('fast');
// return false so any link destination is not followed
return false;
});
});
HTML,
<a class="togglelink" href="#"></a>
<div class="toggle">
Content
</div>

View 6 Replies View Related

Show The Class If Its Not Visible ,or Hide It If It Is Visible?

Jun 23, 2010

I have the following code that don't work like i want it.

Code:
function hideDisplaySingleSuite(textstring) {
var myclass1 = new RegExp('\b'+textstring+'\b');
//Populate the array with all the page tags[code]....

For example.It show objects if I remove the if statement that checks if the class is visible.for example this shows a class and works.

Code:
function hideDisplaySingleSuite(textstring) {
var myclass1 = new RegExp('\b'+textstring+'\b');
//Populate the array with all the page tags[code]....

So my question is why don't this work on a class, it works on an "id"?

Code:
if (allPageTags[i].style.display ==''){
allPageTags[i].style.display = 'none';
}[code]....

I want to show the class if its not visible or hide it if it is visible.How can this be done?

View 4 Replies View Related

JQuery :: How To Get All Elements Of Class

Jun 29, 2011

i want to get all element id's with class name=TestDiv how i can do this? Quick response is needed sample code is below :

[Code]...

View 4 Replies View Related







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