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


ADVERTISEMENT

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 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/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 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

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 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

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 :: 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

Jquery :: Get Serialize To Work - Move And Drop Elements Between Lists

Nov 7, 2010

I have created a jquery sortable list page where the user can move and drop elements between lists. The lists are <li>. how to get serialize to work. Here is a link for a serialize script that I am trying to use. [URL] I program in classic asp and don't understand javascript particularly well.

View 2 Replies View Related

Multi-Level Menu- Making The Lists Show?

May 26, 2011

I am really pressing on to finish this home page menu, and I'm trying to find out why this odd behavior is occurring. There is obviously some conflicting code in my CSS. You can see this odd behaving menu for yourself at productreview. The other thing I'm trying to learn how to do is how to get the 3rd and 4th level lists to appear on the parent item's hover.This is my JavaScript:

Code:
<script src="http://code.jquery.com/jquery-1.6.1.min.js" type="text/javascript"></script>
<script type="text/javascript">

[code]....

View 1 Replies View Related

JQuery :: Hide Elements In One Function?

Jun 29, 2011

Is it possible to hide more than one element using one .hide(); For example can something like this be done -

$('#one', '#two', '#three').hide();
as opposed to listing them individually like -
$('#one').hide();
$('#two').hide();
$('#three').hide();

View 1 Replies View Related

JQuery :: .hide() Not Hiding Elements In IE

Aug 28, 2009

I'm having an interesting IE6 and IE7 issue that may just be par for the course. i'm curious if anyone else has run into this problem.

Here's the URL: [url]

I have a bunch of nested lists with IDs in certain ULs, like <ul id="collapse">. i'm trying to use jQuery .hide() to hide all the ULs with that specific ID. everything works as expected in firefox, safari, chrome, IE8, etc. but IE6 and IE7 seem to only notice the first UL in the DOM tree. so IE6/7 hides that first UL, then stops.

View 3 Replies View Related

Show / Hide Won't Show In Nested List

Jan 22, 2009

I am having problems, basically I have a set of nested lists I need to show and hide

Code:
<ul id="smenu3"><ul id="smenu4">
<li>stuff here..</li>
<li>stuff here..</li>
<li>stuff here..</li>
</ul><ul id="smenu5">
[Code]...

I always want "smenu3" to show with "smenu4" and "smenu5" collapsed... When the user clicks the link, it calls a javascript function to show "smenu4" like so...

[Code]...

View 7 Replies View Related

JQuery :: Hide Elements Cleanly, Not Appear Then Disappear?

Jun 16, 2009

i want to hide some elements on my site, but don't want to makethese inaccessible for users without javascript enabled. Some usersare complaining about being able to see that element for a splitsecond before the page has finished loading and the element is hidden.Is there a way in which I can hide the elements right from the start,

View 2 Replies View Related







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