JQuery :: UI Tabs Updating Multiple DIVS?
Jan 12, 2009I'm trying to get the following code to update two divs at a time rather than one
$(document).ready(function() {
$jQuery("ul").tabs();
}[code].....
I'm trying to get the following code to update two divs at a time rather than one
$(document).ready(function() {
$jQuery("ul").tabs();
}[code].....
I've created an ajax function which retrieves comments from a news article. But if I am logged in I will also have access to an input field for posting comments. The problem / question is that if I use Ajax I can only update one div with the responseText? How would I go about updating another one where I want to insert my form field. Can I make multiple requests in some certain manner or do I simply create another ajax function updating it separately?
http.onreadystatechange = function(){
if(http.readyState == 4){
document.getElementById(newsId).innerHTML = http.responseText;
}}
http.open("GET", "AjaxController.php?func=newsGetComments&showcomments="+newsId, true)
http.send();
I have been trying to do some tooltips for a website and desperately wanted to learn something new and do that with jQuery.However, every time a mouse hovers over a tooltip, all hidden divs are shown, not just the one that supposed to. Here's my html:
Code HTML4Strict:
<div class="tip">
<a href="#"></a>[code].....
For some reason, when my first div loads, I'm seeing all 3 text show up even though they're in different <div> containers:
<script type="text/javascript">
$(document).ready(function() {
$('#Tabs').tabs({ fx: { opacity: 'toggle'} });
});
[Code].....
Here's a print screen: [URL] so you can see that for some reason all of that text is showing up at the same time. Do I need to hide the other divs first? I even tried that with adding $('#Tabs div0').hide(); // Hide all divs but it did not help. I would assume out of the box, it would hide the rest of the divs for me and only show the default first.
I will show u my code pages.
addcart.php
<?php
require_once("../Connection/connection.php");
if(!$_POST['img']) die("There is no such product!");
$img=mysql_real_escape_string(end(explode('/',$_POST['img'])));
$q_result=mysql_query("SELECT * FROM tbl_items WHERE item_photo='".$img."'");
$row=mysql_fetch_assoc($q_result);
$period = $_POST['period'];
$count = $_POST['count']; .....
$('a.button').css('display','block');
$('#cart-text').css('display','none');
}else// hide them{
$('#total').html('');
$('a.button').hide();
$('#cart-text').css('display','block');
}}
My problem is I want to update the totalprice div, when I change the value from the combo boxes. I just want to calculate the rate and the quantity and update it to the totalprice div. But now it is not working. I am retrieving the rate from a database using another php file shown in that script.js. All the values are retrieving and working fine. I use ajax drag and drop care script there. [URL]
Ive done some looking round for options, and have found a tab script which shows different divs depending on which tabs are selected (using javascript to avoid pageloads). My thing is, i want all the content visible at once, and just having the seperate divs re-sorted according to which tab is selected.
So, for example, i would like three divs (DIV1, DIV2, and DIV3, in that order) with corresponding tabs. When TAB2 is clicked, i want the divs to be reordered so that they show in the following order: DIV2, DIV1 and DIV3.
Is this possible? and if it is, is it also possible with a nice little effect from script.aculo.us just for icing on the cake?
I have the following HTML:
<div id="box">
<div id="inner-new">
content
</div>
[Code]....
This code block occurs several times. Sometime the first div ist just "inner" and the second div is missing.
Now I need to update the "new" DIV based on the height of the previous inner-new DIV. For one it works fine:
var height = $('#inner-new').outerHeight();
$('#new').css('margin-top', height*(-1)-30);
But how could I re-use this universally for all my boxes. It needs to check if the DIV "box" contains the DIV "inner-new" as first element, if that is true it need to update the DIV "new".
I tried several things with $('#box').each(function(i) { ... }); but couldn't come up with a solution.
i'm using 'novice to ninja' simple tabs. And I am a novice. i've discovered that child divs of their parent 'tab divs' are hidden... by the following line I think
[Code]....
i have been setting up 3 rows of tabs on one page. it works fine in terms of each panel closes when another is selected but on each row there always remains one tab as selectedDo you know of anyway to ensure for example that when i click a tab on row two and it becomes selected it will also remove the selected state from the tab on any other row?i have tried this but it does not do the trick
//
$("#tabs1 ul li a").click(function(){
$('#tabs2').tabs({ selected: -1});
[code]....
Basically, I need jQuery tabs function but in a simple way, without the tab plugin etc.
However, this is slightly different to the solutions I found throughout Sitepoint. The catch is that I need to change two content containers. Plus the usual "activelink" class when clicked on a tab.
I've tried numerous things, mainly involing the index and n-th child selectors, just can't seem to make it work as a whole. I'd like to use that method in the end, if possible (ie. if the first link in <ul> is clicked then show the first <div> in div#tabs-cotainer and the first <div> in div#tabs-container-2)
It should ofcourse be able to parse as many links/contents as I put in there (probably with a ".each(function)").
Here's the example HTML:
HTML Code:
I am trying to write a new div transition script using jQuery's fadeIn and fadeOut functions. I have a PHP script that writes divs and appropriate links based on the presence of appropriate files. There are no more than seven tabs. If one of the files is there, the corresponding tab and link will be written by the PHP script. If it is not, it won't be. The PHP script knows which files are needed as I use a $_GET call to a variable. My script runs on one single PHP page, but with the $_GET call, it produces different "pages".
Examples:
On one "page", all of the files are present. My PHP script will write:
Link 1 Div 1
Link 2 Div 2
Link 3 Div 3
Link 4 Div 4
[Code]....
I want to fade my desired div based on the ID assigned to the div. Since this will be on one physical page and not multiple physical pages, I want for the script to know a) which divs are available and b) which div is currently visible. I have jQuery 1.5.2 installed (hosted by Google), so any functions can be compatible with that. If a fadeOut can be applied as well, that would be perfect, but a fadeIn is essential. Since I know next to nothing about jQuery, how do I set this up? Especially since I want for it to recognize which divs are being called out of the seven possible divs and the many possible combinations of those divs.
What's the easiest way to update multiple div's with AJAX? Right now I'm using the following code to update one div, but right after I've updated that div I would need to update another div that is dependent on the first div that is updated. Code:
View 2 Replies View RelatedHow could I go about doing this?
View 9 Replies View RelatedI have a page, that will contain up to a couple hundred different widgets on it, that an individual will be able to browse through and choose the size and quantity of the ones they want. Each widget will have form fields associated with it: "size" (small, medium, large) and "quantity", with a "total cost" field underneath that. As the individual looks through the widgets, choosing the size and quantity of the ones they want, I'd like for the "total cost" field to be updated under each widget. I'd also like a "total order cost" field that sums up all the costs of the widgets they want.
I need the script to basically say:
If size = small, then multiply $1 by the quantity.
If size = medium, then multiply $2 by the quantity.
If size = large, then multiply $3 by the quantity.
On my site I have a news page, where users can read part of the news (trimmed with php) and then they click "Read more" to see the full news item. That item then comes up in a popup (using jQuery of course) and should be displayed. To get this to work I'm usingthisby including it like so:
<script type="text/javascript" src="includes/jquery.colorbox.js"></script>
The jQuery code looks like so:
$('.open').colorbox({width:"50%", inline:true, href:"#news"});
This all works great with that one div. The problem is, my news will be coming from a MySQL-query via PHP in a while-loop and I need this effect applied to every single news item. What I tried is to do this:
while($row = mysql_fetch_assoc($rs)) {
echo '<a class="open" href="#">Read more</a>';
echo '<div id="wrapper" style="display:none">';
[code]....
how do I make this work? How do I make jQuery open only the news item I'm clicking on? I know it could possibly be done with (this) and maybe children() or something like that? But I'm totaly lost at the momeny, I've tried loads of stuff with the pieces mentioned above but can't get it to work and most times I just "break" the jQuery and the popup won't even come up at all.
I have a div with a height of 100 pixels.If the content is too much to fit in div, I want to show a 'Read More' link at the bottom.If you then click 'Read More', the div expands to full height so all the content can be seen and the link text changes to 'Read Less'.If you then click 'Read Less', the div contracts back to 100 pixels.I've found solutions that can handle the above situation, but I want to have multiple divs with the same class that all work independantly of each other.So I'd have the following HTML
[code]
<div class="openclose">
...some content...
[code]....
I'm trying to piece together a little div which slides out and shows various links to sites like Digg, Reddit to share the story with. I've got it kind of working but when there are multiple divs on the page, named the same like in each article of a post on a Wordpress blog. Only the top ones work and the rest don't do anything...I'm trying to get it do something like the image => HereThis is an example I'm trying to get to work but the second "slickbox" div never shows
View 1 Replies View RelatedI'm trying to use nextUntil to select all the .cell divs between the .start-date and .end-date, the code works for the .cell's within it's .cal-container but if wont work over multiple .cal-containers.The code I have is$('.start-date').nextUntil('.end-date').addClass('fill-date');
<div class="cal-container">
<div class="cell" id="1" title="01-01-2011">1</div>
<div class="cell" id="2" title="02-01-2011">2</div>
[code]....
I want to animate divs on click . But the problem is there are multiple divs and I unable to get the height of each div
my code isfunction show (div) {
var hei = $('.a').height();
$('.show').click(function(){
$('.text').animate({'height' : hei + 'px'})
[Code]...
Getting myself back into jQuery and have an issue which I didn't previously fix, and was wondering if anyone would be able to assist me. I have multiple DIVs (up to 50 on one page) that I wish to individually be able to hide and close an extra DIV once pressing the 'Details' to show, and 'Hide' to hide the extra hidden DIV.
[Code]...
I am trying to get the height of a div that is inside 7 other divs. I noticed the height() method works with the first and second div, but it does not work after that.
Example :
<div id="first">
<--------------------------- $("first").height(); works ![code]....
how to get the height of a div that is inside multiple other divs ?
I'm new to jQuery, and I'm having issues with showing my DIVs correctly. The problem with the script at the moment, is that it currently opens up every single .display div, whereas I only want it to open up the one which corresponds to the.input a.edit which I've clicked.
The script hides them individually, displays the hide button and makes the show button display correctly like I wish, but it's displaying all the the .display div's at the same time which isn't what I want. For reference here is my jQuery script:
[Code]...
I need to be able to fade in 3 divs but not all at the same time, I need one to fade when thats finished, fade in then the next, then the next. Can anyone help me with this? I assume its got something to do with queue's but im not 100%
View 1 Replies View RelatedHow can I display a bunch of DIVs in multiple columns? Like Flex's TileList component.
A
B
C
C
[code]....
$("#addURLSArea").hide();
$('.jqTransformCheckbox').click(function(){
if ($('#multCheck:checked').val() == 'on') {
$("#addURLSArea").slideDown();
} else {
$("#addURLSArea").slideUp();
}});
I want to use this 4 times on a form. How do I change this so I can have it target 4 different divs?
I have a group of 4 divs and I'm looking to use jQuery to animate them once, then have a delay using delay(), and then run another set of animations on them, putting the divs back to their original configuration. Here's the code that I have:
//only selectors called 'option1' are affected by delay, and not 'option1 img' or 'option2'
$("#option1").showOption1().delay(3000).hideOption1();
//if i don't attach to #option1, delay doesn't work, but the animations that need to happen simultaneously work
[Code]....
will work from hideOption1() after the delay. The rest of hideOption1() is fired immediately after showOption1() finishes, ignoring the delay.
On the other hand, if I run line 5, all the code in hideOption1() runs simultaneously as desired, but ignores the delay entirely, running immediately after showOption1() finishes. How can I have all the code in hideOption1() run simultaneously after the delay?