[jQuery] Re: Delay function to wait for post

2009-03-25 Thread Klaus Hartl

async:false may freeze the browser and is in general not a good idea
unless you know that your network, server etc will 100% work.

Why don't you simply put the last line into the callback as well?


--Klaus


On 24 Mrz., 22:40, James james.gp@gmail.com wrote:
 Add the {async:false} option to your $.get. This tells JavaScript to
 wait for the response before continuing with the rest of the script.
 By default, AJAX is asynchronous.

 On Mar 24, 4:13 am, aeg1s aeg1s1...@gmail.com wrote:

  I have the following code:

  $('#r_0_0').blur(function() {

   var x = $('#r_0_0').val();
    var y=#d_0;
    $(y).empty();
    $.get(apps/P5001/call/LineItems.lasso?LITM= + x + Line= +
  'r_0_0' + TEST= + y,function(data2){
    $(y).empty();
    $(y).append(data2);
    },html);

    $('#addnew').click();

  });

  The last line #addnew is adding a new line to a html table, and the
  other code is updating a div with information from a database call. It
  is all processing correctly, except the addnew is running before the
  database query.

  How can I get the addnew to wait for the prior commands to finish?




[jQuery] Re: Multiple lists that should only show x amount of items until you expand them

2009-03-25 Thread Jens Bengtsson

I'm starting to think that this is not possible without having
different names/classes on the different menus which makes it hard
since they are generated form a resultset.

On Mar 24, 8:18 pm, Jens Bengtsson poserdo...@gmail.com wrote:
 OK, this is what I have.

 Multiple lists that I can collapse and expand.

 What I want is for them to only show x amount of items until I expand
 them.

 Say x = 2

 In Section A the following would be shown
 Link A-A
 Link A-B

 In Section B the following would be shown
 Link B-A
 Link B-B

 etc.

 And when I push a Section link it will show all

 html
 head
 script type=text/javascript src=jquery.js/script
 script type=text/javascript
 $(document).ready(function() {

                         $(#menu  li  a[class=expanded] + 
 ul).slideToggle(medium);

                         $(#menu  li  a).click(function() {
                                 
 $(this).toggleClass(expanded).toggleClass(collapsed).find(+
 ul).slideToggle(medium);
                         });
                 });
 /script

 /head
 body
 ul id=menu
         lia class=expandedSection A/a
                 ul
                         lia href=#Link A-A/a/li
                         lia href=#Link A-B/a/li
                         lia href=#Link A-C/a/li
                         lia href=#Link A-D/a/li
                 /ul
         /li

         lia class=expandedSection B/a
                 ul
                         lia href=#Link B-A/a/li
                         lia href=#Link B-B/a/li
                         lia href=#Link B-C/a/li
                         lia href=#Link B-D/a/li
                 /ul
         /li
                 lia class=expandedSection C/a
                 ul
                         lia href=#Link C-A/a/li
                         lia href=#Link C-B/a/li
                         lia href=#Link C-C/a/li
                         lia href=#Link C-D/a/li
                 /ul
         /li
 /ul
 /body
 /html


[jQuery] Re: Multiple lists that should only show x amount of items until you expand them

2009-03-25 Thread xPheRe

I'd prefer to go with a CSS solution like this:

body
style
#menu  li  a + ul  li + li + li { display:none; }
#menu  li  a.expanded + ul  li { display:list-item; }
/style
ul id=menu
li
aSection A/a
ul
lia href=#Link A-A/a/li
lia href=#Link A-B/a/li
lia href=#Link A-C/a/li
lia href=#Link A-D/a/li
/ul
/li

li
aSection B/a
ul
lia href=#Link B-A/a/li
lia href=#Link B-B/a/li
lia href=#Link B-C/a/li
lia href=#Link B-D/a/li
/ul
/li
li
aSection C/a
ul
lia href=#Link C-A/a/li
lia href=#Link C-B/a/li
lia href=#Link C-C/a/li
lia href=#Link C-D/a/li
/ul
/li
/ul
script type=text/javascript src=jquery.js/script
script type=text/javascript
$(function() {
$('#menu  li  a').click(function() {
$(this).toggleClass('expanded')
});
});
/script
/body

But if you want to mantain the 'toggle' animation, you can do
something on those lines:

$(function() {
$('#menu  li  a + ul  li + li + li').addClass('collapsible').toggle
();
$('#menu  li  a').click(function() {
$(this).toggleClass('expanded').next('ul').children
('li.collapsible').slideToggle('medium');
});
});

Hope it helps


On 24 mar, 20:18, Jens Bengtsson poserdo...@gmail.com wrote:
 OK, this is what I have.

 Multiple lists that I can collapse and expand.

 What I want is for them to only show x amount of items until I expand
 them.

 Say x = 2

 In Section A the following would be shown
 Link A-A
 Link A-B

 In Section B the following would be shown
 Link B-A
 Link B-B

 etc.

 And when I push a Section link it will show all

 html
 head
 script type=text/javascript src=jquery.js/script
 script type=text/javascript
 $(document).ready(function() {

                         $(#menu  li  a[class=expanded] + 
 ul).slideToggle(medium);

                         $(#menu  li  a).click(function() {
                                 
 $(this).toggleClass(expanded).toggleClass(collapsed).find(+
 ul).slideToggle(medium);
                         });
                 });
 /script

 /head
 body
 ul id=menu
         lia class=expandedSection A/a
                 ul
                         lia href=#Link A-A/a/li
                         lia href=#Link A-B/a/li
                         lia href=#Link A-C/a/li
                         lia href=#Link A-D/a/li
                 /ul
         /li

         lia class=expandedSection B/a
                 ul
                         lia href=#Link B-A/a/li
                         lia href=#Link B-B/a/li
                         lia href=#Link B-C/a/li
                         lia href=#Link B-D/a/li
                 /ul
         /li
                 lia class=expandedSection C/a
                 ul
                         lia href=#Link C-A/a/li
                         lia href=#Link C-B/a/li
                         lia href=#Link C-C/a/li
                         lia href=#Link C-D/a/li
                 /ul
         /li
 /ul
 /body
 /html


[jQuery] Re: Reusing script

2009-03-25 Thread xPheRe

I would go with the common parent or the common class solutions, as
weidc and Thomas said.
Another way to have jQuery match your 'steps', use something on those
lines:

var steps = $('[class*=step]).filter(function(){ return /\bstep\d+
\b/.test(this.className) })

then

steps.bind('click', function() {
steps.addClass('hiddenstep');
$(this).removeClass('hiddenstep')
})

On 24 mar, 10:47, phelyer paulhel...@gmail.com wrote:
 Hi,

 I am using JQuery to show and hide sections of text within my page.
 The page has 10 sections of thext and 10 links.

 I want to initially hide all 10 sections of text, and then show
 section 3 when the link for section 3 is clicked, but make sure any
 previously shown sections are then hidden.

 Here is what I have used so far which dies wxactly what I want but
 seems very long winded.

 $(document).ready(function hideAll() {
         //$('.stepText').hide();
         $('.step1').addClass('hiddenstep');
         $('.step2').addClass('hiddenstep');
         $('.step3').addClass('hiddenstep');
         $('.step4').addClass('hiddenstep');
         $('.step5').addClass('hiddenstep');
         $('.step6').addClass('hiddenstep');
         $('.step7').addClass('hiddenstep');
         $('.step8').addClass('hiddenstep');
         $('.step9').addClass('hiddenstep');
         $('.step10').addClass('hiddenstep');

         $('.step1').click(function(){
                 $('.step1').removeClass('hiddenstep');
                 $('.step2').addClass('hiddenstep');
                 $('.step3').addClass('hiddenstep');
                 $('.step4').addClass('hiddenstep');
                 $('.step5').addClass('hiddenstep');
                 $('.step6').addClass('hiddenstep');
                 $('.step7').addClass('hiddenstep');
                 $('.step8').addClass('hiddenstep');
                 $('.step9').addClass('hiddenstep');
                 $('.step10').addClass('hiddenstep');
         });

         $('.step2').click(function(){
                 $('.step1').addClass('hiddenstep');
                 $('.step2').removeClass('hiddenstep');
                 $('.step3').addClass('hiddenstep');
                 $('.step4').addClass('hiddenstep');
                 $('.step5').addClass('hiddenstep');
                 $('.step6').addClass('hiddenstep');
                 $('.step7').addClass('hiddenstep');
                 $('.step8').addClass('hiddenstep');
                 $('.step9').addClass('hiddenstep');
                 $('.step10').addClass('hiddenstep');
         });

         $('.step3').click(function(){
                 $('.step1').addClass('hiddenstep');
                 $('.step2').addClass('hiddenstep');
                 $('.step3').removeClass('hiddenstep');
                 $('.step4').addClass('hiddenstep');
                 $('.step5').addClass('hiddenstep');
                 $('.step6').addClass('hiddenstep');
                 $('.step7').addClass('hiddenstep');
                 $('.step8').addClass('hiddenstep');
                 $('.step9').addClass('hiddenstep');
                 $('.step10').addClass('hiddenstep');
         });

         $('.step4').click(function(){
                 $('.step1').addClass('hiddenstep');
                 $('.step2').addClass('hiddenstep');
                 $('.step3').addClass('hiddenstep');
                 $('.step4').removeClass('hiddenstep');
                 $('.step5').addClass('hiddenstep');
                 $('.step6').addClass('hiddenstep');
                 $('.step7').addClass('hiddenstep');
                 $('.step8').addClass('hiddenstep');
                 $('.step9').addClass('hiddenstep');
                 $('.step10').addClass('hiddenstep');
         });

         $('.step5').click(function(){
                 $('.step1').addClass('hiddenstep');
                 $('.step2').addClass('hiddenstep');
                 $('.step3').addClass('hiddenstep');
                 $('.step4').addClass('hiddenstep');
                 $('.step5').removeClass('hiddenstep');
                 $('.step6').addClass('hiddenstep');
                 $('.step7').addClass('hiddenstep');
                 $('.step8').addClass('hiddenstep');
                 $('.step9').addClass('hiddenstep');
                 $('.step10').addClass('hiddenstep');
         });

         $('.step6').click(function(){
                 $('.step1').addClass('hiddenstep');
                 $('.step2').addClass('hiddenstep');
                 $('.step3').addClass('hiddenstep');
                 $('.step4').addClass('hiddenstep');
                 $('.step5').addClass('hiddenstep');
                 $('.step6').removeClass('hiddenstep');
                 $('.step7').addClass('hiddenstep');
                 $('.step8').addClass('hiddenstep');
                 $('.step9').addClass('hiddenstep');
                 $('.step10').addClass('hiddenstep');
         });

         $('.step7').click(function(){
                 $('.step1').addClass('hiddenstep');
                 

[jQuery] Re: Deleting an entire tr

2009-03-25 Thread xPheRe

Try using:

$(this).parents('tr:eq(0)')

or if using jQuery 1.3 or newer, you can use this one too:

$(this).closest('tr')

On 24 mar, 10:59, lionel28 lmarte...@haitiwebs.net wrote:
 Hello, I am trying to remove an entire tr row.

 Please, someone help me.
 This is what I use

 #
 $(document).ready(function() {
     $('a.delete').click(function(e) {
          e.preventDefault();  
         var parent = $(this).parent('td').parent('tr');
         $.ajax({
             type: 'get',
             url: 'delete.php',
             data: 'ajax=1delete=' + parent.attr('id').replace('image-',''),
             beforeSend: function() {
                 parent.animate({'backgroundColor':'#fb6c6c'},300);
             },
             success: function() {
                 parent.slideUp(300,function() {
                     parent.remove();
                 });
             }
         });
     });

 });

 
 in the tr, I have the id. And in the td contents I have a link plus a linked
 image of a trash bin with the class=delete. The idea is when you click on
 image it's supposed to remove entire tr with contents.
 #

 The only way I got it to work is to use use var parent = $(this).parent();
 and place the id in a div and remove the linkage in the file and wrap around
 the entire linked image with a class=delete,  the text , the image

 -
 I really need to keep the other link.

 so please what would be the correct syntax to get the tr?

 var parent = $(this).parent('td').parent('tr'); does not work for me.

 Thank you
 --
 View this message in 
 context:http://www.nabble.com/Deleting-an-entire-tr-tp22677143s27240p22677143...
 Sent from the jQuery General Discussion mailing list archive at Nabble.com.


[jQuery] Re: ajax timeout question

2009-03-25 Thread Martijn Houtman


On Mar 25, 2009, at 4:32 AM, comslash.com wrote:


I believe you can set the value to null or 0 to not have the request
time out ... but you may want to implement something on error instead
of this to say attempt the search again x times then print msg server
is busy or something along those lines.


But AFAIK the onError is never called when a script times out, right?  
No response means no error?


I have had lots of problems with this, trying to make a reliable way  
of doing AJAX queries, even on slow connections/servers. I ended up  
using an AJAX manager (there are some nice jQuery implementations for  
it), and use a manual timeout (setTimeout) that aborts and retries  
the call (you can do this say three times and then give up, or loop  
infinitely). Whenever the onSuccess is called, I stop the manual  
timeout (so the abort is never called). This way I make sure the call  
is finished, and I get to print some nice messages to the user when  
things take too long.


I'd recommend using some sort of AJAX manager for sites with lots of  
AJAX queries.


Regards,
--
Martijn.

[jQuery] Delay for $get.Script() callback function

2009-03-25 Thread Maujor


The documentation for $.getScript()  function explicit says:
*If you load functions via getScript, make sure to call them after a delay.*
[1]

It is suppose that callback functions are always called after a request.
So, it is suppose too that this requeriment is valid for $.get(), $.post,
$.getJSON etc?
But documentation doesn't mention the requeriment for other kinds of
requests.

Or, am I missing something?

Can someone explain me the needs for this requirement?
What does it means exactly?

[1] http://docs.jquery.com/Ajax/jQuery.getScript#urlcallback
-- 
View this message in context: 
http://www.nabble.com/Delay-for-%24get.Script%28%29-callback-function-tp22698462s27240p22698462.html
Sent from the jQuery General Discussion mailing list archive at Nabble.com.



[jQuery] Re: Deleting an entire tr

2009-03-25 Thread lionel28


Thanks for replying.
I managed to get it.


Berny Cantos wrote:
 
 
 Try using:
 
 $(this).parents('tr:eq(0)')
 
 or if using jQuery 1.3 or newer, you can use this one too:
 
 $(this).closest('tr')
 
 On 24 mar, 10:59, lionel28 lmarte...@haitiwebs.net wrote:
 Hello, I am trying to remove an entire tr row.

 Please, someone help me.
 This is what I use

 #
 $(document).ready(function() {
     $('a.delete').click(function(e) {
          e.preventDefault();  
         var parent = $(this).parent('td').parent('tr');
         $.ajax({
             type: 'get',
             url: 'delete.php',
             data: 'ajax=1delete=' +
 parent.attr('id').replace('image-',''),
             beforeSend: function() {
                 parent.animate({'backgroundColor':'#fb6c6c'},300);
             },
             success: function() {
                 parent.slideUp(300,function() {
                     parent.remove();
                 });
             }
         });
     });

 });

 
 in the tr, I have the id. And in the td contents I have a link plus a
 linked
 image of a trash bin with the class=delete. The idea is when you click
 on
 image it's supposed to remove entire tr with contents.
 #

 The only way I got it to work is to use use var parent =
 $(this).parent();
 and place the id in a div and remove the linkage in the file and wrap
 around
 the entire linked image with a class=delete,  the text , the image

 -
 I really need to keep the other link.

 so please what would be the correct syntax to get the tr?

 var parent = $(this).parent('td').parent('tr'); does not work for me.

 Thank you
 --
 View this message in
 context:http://www.nabble.com/Deleting-an-entire-tr-tp22677143s27240p22677143...
 Sent from the jQuery General Discussion mailing list archive at
 Nabble.com.
 
 

-- 
View this message in context: 
http://www.nabble.com/Deleting-an-entire-tr-tp22677143s27240p22698943.html
Sent from the jQuery General Discussion mailing list archive at Nabble.com.



[jQuery] Jquery UI 1.7.1 Tabs - Close open tab on mouseout from overall tab group

2009-03-25 Thread jq noob

I am currently using

$(document).ready(function()
{
var $tabs = $(#tabs).tabs({
selected: -1,
event: 'mouseover',
collapsible: true
});

I have tried including a  .mouseout(function(){
//$tabs.tabs('option', 'selected', -1);
$tabs.tabs('select',-1);
}); // Used various combos of these

I can see that a mouseout event is fired, when you leave the tab and
move your mouse into the now showing div and another mouseout event is
fired when you leave that div.

What is the correct way to hide that div on mouseout and basically set
the tab group back to nothing selected once your focus is no longer on
that tab group?

I found some posts from February 08 and September 08 but none of those
solutions worked.

I was thinking that I could bind something to the wrapper but not
sure how or if that would even be the correct way.

div class=wrapper

div id=tabs
ul
lia href=#tabs-1Filter 1/a/li
lia href=#tabs-2Filter 2/a/li
lia href=#tabs-3Filter 3/a/li
/ul
div id=tabs-1html/div
div id=tabs-2html/div
div id=tabs-3html/div
/div
/div



[jQuery] Re: Tabs and tables

2009-03-25 Thread MorningZ

any valid HTML can go inside those div's that are the content tabs

Your breakage has absolutely nothing to do with the tabs plugin but
rather with your HTML usage



On Mar 24, 11:14 pm, Joe Tseng jtseng...@gmail.com wrote:
 Currently I am working on an entry form that I've realized has become too
 long and would like to break up using Tabs.  My current form uses tables
 (yes I should use divs but I'm still used to tables) and I thought I could
 just put in child tables inside the divs used by Tabs.  I've come to
 discover this breaks the entire page and was wondering if others have been
 able to use child tables and Tabs successfully.

 tia,

  - Joe

 --

 Failure is always an option -- Adam Savage


[jQuery] How to extend an UI class?

2009-03-25 Thread world.qu...@gmail.com

For example if I would like to extend the progress bar, to write a
text...
I would extend some functions (like the initialization, and the value
setter functions) and I have to call super.function (except for the
text management calls)

How can I accomplish this?
(how to call super(...) how to excend an UI class?)

Thanks for the answers.


[jQuery] Re: Jquery Autocomplete Problem

2009-03-25 Thread wesley...@gmail.com

Hi,
i have a question,
how to manually fire the autocomplete event?

input type=text id=acTxt /
span class=pTxtaa/span,
span class=pTxtbb/span,
span class=pTxtcc/span,
span class=pTxtdd/span ...

$(document).ready(function(){
$(#acTxt).autocomplete(theUrl, {
minChars: 2,
matchContains: true,
max: 20
});

$(.pTxt).click(function() {
$(#acTxt).val($(this).html()? $(this).html():'');
});
});


if the user click on SPAN with class 'pTxt', the innerHTML of the SPAN
will place in the textbox,
how to activate the autocomplete without pressing UP, DOWN, PAGE UP,
and ?


[jQuery] scrollto function works with static html, but not with identical generated html

2009-03-25 Thread ryan

hi all -

i'm just trying to scroll an iframe without a big standard scrollbar,
but have run into a confusing problem: i'm able to scroll static html
pages loaded in the iframe fine, but for some reason am unable to
scroll pages that have been generated by drupal or blogger in firefox.
(safari works fine).

my test page is at http://nickzmusic.com/nick.html note the two nav
links at the top to two identical pages (one static one generated).
one works and one doesn't. any ideas as to why?

thanks in advance everyone, and especially to ariel flesler!

peace.
-ryan


[jQuery] Jquery Validation and Autobox2 by BigRedSwitch

2009-03-25 Thread Egoman

Has anyone managed to get Validation working with Autobox2 by
BigRedSwitch.

I am fairly new to Javascript coding but I do have a basic
understanding and have managed to get the Validation working on the
form (which was really easy) as well as Autobox2 but they just won't
be friends.

Has anyone else managed this ?



[jQuery] Re: Toggle stealing my sanity....

2009-03-25 Thread eddiegroves

The changes to :visible/:hidden in 1.3.2 appears to have introduced a
bug to toggle: http://dev.jquery.com/ticket/4233 and see this comment
http://blog.jquery.com/2009/02/20/jquery-132-released/#comment-386734

Back to 1.3.1 for now.


[jQuery] Intelisense in VS2008

2009-03-25 Thread simonxy

Hi, I copied jquery-1.3.2.js and jquery-1.3.2-vsdoc.js files into the
same directory and intelisense works, but not in complete. For
example, I don't have almost any properties and methods of event
object, like event.stopPropagation() or event.isPropagationStopped()
and similar.
Why intelisense of event object doesn't work?

Thank you for your answer,
Simon


[jQuery] Cycle plugin adds white background in ie6 and ie7

2009-03-25 Thread Smoggy

For some strange reason in IE I get a white background added to my
li tag  each li has a transparent background PNG image.  So it get
white corners where I should see a nice textured background basically
cycle changes the header of the site.  which is rounded on the top
works fine in both FF and safari.  any ideas where the white
background is coming from and how to fix it.  If I remove the cycle js
it works correctly.  if i use the IE developer tool bar the inline
style on the li looks like this.

LI class=relaxed png style=DISPLAY: block; Z-INDEX: 6; LEFT: 0px;
ZOOM: 1; POSITION: absolute; TOP: 0px; BACKGROUND-COLOR: #ff
cycleH=378 cycleW=919 jQuery1237943038750=5

I checked a different site I created and it was fine no background
color applied in IE


[jQuery] Re: creating search page with click for more results.

2009-03-25 Thread iskills

Thanks James - that helps quite a bit!

I am now able to execute an alert, using the .live function for the
added elements on the page.

The issue I am now having is that the display of the order_logs
element will not show.  Do I need to do another .live call on that?
I am a bit confused now ;)

div class=dlorder
span class=orderida href=# title=1 class=vieworderdata1/
a/span
span class=orderdate2009-03-24/span
span class=name123 - wiget/span
div style=display: none class=order_logs1
span class=access_keyAccess Key: 3452/span
div class=log
span class=log_date2009-23-04 10:0004/span
span class=log_ip0.0.0.0/span
span class=disk_noDisk Number: 1/span
/div
/div
/div

That is the return data from that original AJAX call again, and this
is the new javascript:
$(document).ready(function(){
$(#sboid).click(function(){

$(#search_results).load(/cart/admin/files/ajax.html,{order_id:$
('#orderid').val(),action:digital_search});
});
$(.vieworderdata).live(click,function() {
$(.order_logs1).show(slow);
});
});

So I have the .live function for the click, and if I do an alert in
that call, it executes.  However, the .show does not in this case...

Is it again, something in the formatting of the elements, or am I
missing something else here

Thanks again!


On Mar 24, 6:39 pm, James james.gp@gmail.com wrote:
 The issue is that once you bind a click handler on existing elements,
 it will not take effect on elements added in the future. You can re-
 bind it again once you added the new content, or you can use jQuery's
 live() function in place of click() to have elements added in the
 future to also have the event attached. This is good since once you
 call it on page load, you don't have to call it 
 again.http://docs.jquery.com/Events/live

 Another possible issue with your code is your use of element IDs. You
 can only have one unique ID on one HTML page at any time. If you keep
 clicking on more, you're going to have many 'vieworderdata' IDs, and
 that's not valid. To offset this issue, use the class attribute
 instead, as you can have more than one element with the same class
 attribute on a page. Then change your click binding to use
 the .myClass instead of #myID.

 Another minor issue is that your should use double-quotes for your
 element attributes in HTML.
 Instead of:
 div id='dlorder'

 use:
 div id=dlorder

 On Mar 24, 11:08 am, iskills i...@infiniteskills.com wrote:

  OK - let me please preface this by the fact that I am now 12 hours
  into jQuery, with a pretty basic Javascript understanding, and years
  of PHP work.  I could not find the answer to my questions, mostly
  because I don't exactly know how to frame them!

  I am creating a search with expandable results.  The search part I
  have down just fine, I have a form submit button that executes a .load
  function that drops the search results to a div.  So far so good -
  this works wonders.  Now, what I am trying to accomplish and cannot,
  is for a linked item in that returned data, to then show/hide
  additional data passed through to it in a hidden div.

  So my javascript is this:
  $(document).ready(function(){
          $(#sboid).click(function(){
                  
  $(#search_results).load(ajax.html,{order_id:$('#orderid').val
  (),action:digital_search});
          });
          $(#vieworderdata).click(function() {
                  $(#order_logs).show(slow);
          });

  });

  The return from the ajax.html page would be something like:
  div id='dlorder'
          span id='orderid'a href='#' id='vieworderdata'1234/a/span
          span id='orderdate'2009-03-24/span
          span id='name'4456 - widget/span
          div style='display: none' id='order_logs'
                  span id='access_key'Access Key: absdcef/span
                  div id='log'
                          span id='log_date'2009-03-24 10:00:02/span
                          span id='log_ip'0.0.0.0/span
                          span id='disk_no'Disk Number: 1/span
                  /div
          /div
  /div

  That gets returned into the     div id='search_results'/div in the
  starting HTML page.

  So, when I click on the a href in the returned data, in theory, that
  hidden block will be displayed.  Not happening.  I am not sure if I am
  not accessing it properly in the javascript above, or if it is not
  working because it was not a part of the original page DOM, and cannot
  be accessed?

  Further to this, once THAT is working, there is an issue that there
  may be MANY results returned, and how to reference the a href that
  was clicked, to the hidden div to be displayed.  I can easily return
  different div names, appending a running count to them
  (vieworderdata1, vieworderdata2, vieworderdata3, etc), but how to
  create 

[jQuery] window unload event too slow - delay when navigate away from the page

2009-03-25 Thread Khoa

One of the pages I'm working on at the moment is quite big, it has a
huge amount of HTML elements and many of them have events bound to
them. So whenever I navigate out of that page, there is a huge delay.
The browser seems to be freezing during that time. And then it loads
the next page (the page that I go to).

I notice that, this is because of the window unload event, which is
specified in the source code at:

jQuery( window ).bind( 'unload', function(){
for ( var id in jQuery.cache )
// Skip the window
if ( id != 1  jQuery.cache[ id ].handle )
jQuery.event.remove( jQuery.cache[ id ].handle.elem );
});

Is there anyway that we can speed up this event? Maybe in the next
release of jQuery? This snippet seems to take too much time to run on
large page. If there is not, can I just remove it? Why do we need this
function? Sorry, I'm still new to JS, so I'm don't know why we need
this, please advise.

Thanks.


[jQuery] jquery.js in XUL dialog

2009-03-25 Thread Alexey Demakov

Hi all,

I develop Firefox extention and like to use jQuery. It works when I
use it from overlay, but doesn't when inserted in dialog:

overlay xmlns=http://www.mozilla.org/keymaster/gatekeeper/
there.is.only.xul orient=vertical
script src=jquery.js/
script src=myscript.js/

In this case I can use jQuery from myscript.js

But in this case

dialog id=mydialog buttons=accept,cancel buttonpack=center
xmlns=http://www.mozilla.org/keymaster/gatekeeper/
there.is.only.xul
title=My Dialog
ondialogaccept=onAccept();
script src=jquery.js/

all XUL controls inside dialog are not shown (except standard
buttons).
When I remove
script src=jquery.js/
the dialog works just fine
When I change dialog to window the controls are shown also (without
standard buttons, of course).

Firefox 3.0.7, jQuery 1.3.2

Is it jQuery bug?


[jQuery] How to force jCarousel to scroll a certain amount of items at a time?

2009-03-25 Thread Ian

Please check the testing page:
http://one.xthost.info/ian/jcarousel/test-1.html

There are twelve items. And scroll: 6 was set in the configuration
in order to scroll six items at a time. But it scrolls only five items
and the last item ( box 12 ) is invisible. I have to scroll once again
to see box 12.

It is probably because the CSS declaration margin-right: -3px on
each li so the three pixels left and right borders of all boxes are
overlapped with each other. That means the left border of box 7 is
within the visible range at first, as shown in this figure:
http://one.xthost.info/ian/jcarousel/box7-border.png

Is there a solution to force it to always slide six items?


Ian


[jQuery] Fix for broken nextUntil

2009-03-25 Thread johan . borestad

Hi everyone!

I wanted to use nextUntil, but noticed that it was broken in jQuery
1.3.2 (I know that the plugin isn't official yet and that is wanted
in the core - looking at the roadmap).

Well, this line wasn't working:
// If we find a match then we need to stop
if ( jQuery.filter( expr, [i] ).r.length ) break;

I'm curious, what was the r-property doing there before? :)

Well, I created a small patch, that also gives the oppurtunity to also
include the last selector
default is as usual:

 $(h3).nextUntil();
 = [ div, p, p, h3, div, p ]

 $(h3).nextUntil(h3);
 = [ div, p, p ]

But if a last value true is given, it also includes that that last
selector:
 $(h3).nextUntil(h3, true);
 = [ div, p, p, h3 ]

Hope that someone can make use of this.
All credit goes to John Resig for his excellent work with jQuery (

jQuery.fn.nextUntil = function(expr, include) {
   var match = [];
include = include ? true : false

// We need to figure out which elements to push onto the array
this.each(function(){
// Traverse through the sibling nodes
for( var i = this.nextSibling; i; i = i.nextSibling ) {
// Make sure that we're only dealing with elements
if ( i.nodeType != 1 ) continue;

// Add it on to the stack if include is set
if ( include ) {
match.push( i );
}
// If we find a match then we need to stop
if ( jQuery.filter( expr, [i] ).length ) break;

// Add it on to the stack if include is not set
if (! include ) {
match.push( i );
}
}
});
   return this.pushStack( match, arguments );
}

Best regards
Johan Borestad


[jQuery] Need some help with a image opacity thingy.

2009-03-25 Thread MindTooth

Hello.

Please take a look at this code:
[code]  $(.box img).fadeTo(500, 0.6); // This sets 
the opacity
of the thumbs to fade down to 60% when the page loads

$(.box img).hover(function(){
$(this).fadeTo(normal, 1.0); // This 
should set the opacity to
100% on hover
},function(){
$(this).fadeTo(slow, 0.6); // This should set 
the opacity
back to 60% on mouseout

})[/code]

The problem I experience is that when I hover the images several times
in a row. They blink as many times as I have hovered them.
Appreciated if someone could direct me to a solution.


Birger :)


[jQuery] how to insert html returned from ajax request into dom

2009-03-25 Thread adilraufk...@gmail.com

I am new to jquery,

I have a page that gets data in the form of html returned from an ajax
call. I want this data to be sticked to DOM and behave asif it was
always a part of the first loaded contents.

Detail

div id=ajaxReturnedDataDivhtml data comes here/div

html data
a href=# id=toBeClickedshow an alert/a

$(document).ready(function() {
  $(ajaxReturnedDataDiv#  a).click(function() {
 alert($(this));
  });
   });

can anybody tell me whats the issue in this code.
Thanks in advance


[jQuery] How to activate autocomplete in this case

2009-03-25 Thread wesley...@gmail.com

Hi,
i have a question,
how to manually fire the autocomplete event?

input type=text id=acTxt /
span class=pTxtaa/span,
span class=pTxtbb/span,
span class=pTxtcc/span,
span class=pTxtdd/span ...

$(document).ready(function(){
$(#acTxt).autocomplete(theUrl, {
minChars: 2,
matchContains: true,
max: 20
});

$(.pTxt).click(function() {
$(#acTxt).val($(this).html()? $(this).html():'');
});
});


if the user click on SPAN with class 'pTxt', the innerHTML of the SPAN
will place in the textbox,
how to activate the autocomplete without pressing UP, DOWN, PAGE UP,
and ?


[jQuery] jquery.js in XUL dialog

2009-03-25 Thread Alexey Demakov

Hi all,

I develop Firefox extention and like to use jQuery. It works when I
use it from overlay, but doesn't when insertede in dialog:

overlay xmlns=http://www.mozilla.org/keymaster/gatekeeper/
there.is.only.xul orient=vertical
script src=jquery.js/
script src=myscript.js/

In this case I can use jQuery from myscript.js

But in this case

dialog id=mydialog buttons=accept,cancel buttonpack=center
xmlns=http://www.mozilla.org/keymaster/gatekeeper/
there.is.only.xul
title=My Dialog
ondialogaccept=onAccept();
script src=jquery.js/

all XUL controls inside dialog are not shown (except standard
buttons).
When I remove
script src=jquery.js/
the dialog works just fine
When I change dialog to window the controls are shown also (without
standard buttons, of course).

Firefox 3.0.7, jQuery 1.3.2, Windows XP SP3

Is it jQuery bug?


[jQuery] window unload event too slow - delay when navigate away from the page

2009-03-25 Thread Khoa

One of the pages I'm working on at the moment is quite big, it has a
huge amount of HTML elements and many of them have events bound to
them. So whenever I navigate out of that page, there is a huge delay.
The browser seems to be freezing during that time. And then it loads
the next page (the page that I go to).

I notice that, this is because of the window unload event, which is
specified in the source code at:

jQuery( window ).bind( 'unload', function(){
   for ( var id in jQuery.cache )
   // Skip the window
   if ( id != 1  jQuery.cache[ id ].handle )
   jQuery.event.remove( jQuery.cache
[ id ].handle.elem );
});

Is there anyway that we can speed up this event? Maybe in the next
release of jQuery? This snippet seems to take too much time to run on
large page. If there is not, can I just remove it? Why do we need this
function? Sorry, I'm still new to JS, so I'm don't know why we need
this, please advise.

Thanks.


[jQuery] Fill the second div with data - jQuery

2009-03-25 Thread ghogilee

Hi all,
I have a problem with some issue. Is it possible (and how) to make
this: (I will try to explain simple as I can):
It's kinda, like two select boxes, but I want to achieve same result
only with two div's.

1. I have one DIV, populated with linked data from database (car
makes).
2. When I click on the link in that DIV, i want to populate second DIV
with related data from the first (car models based on selected make in
first DIV)
3. It's very complicated for me and I have no solutions whatsoever :(.

Thanx in advance


[jQuery] Want to pass a variable to the selector

2009-03-25 Thread Jens Bengtsson

This is my HTML

 liaDOCUMENT/LAROSATE/a (1)
ul
 lia href=/Default.aspx?q=*amp;navigator=DOCUMENT/LAROSATE:0XD6
VRIGT0XD6 VRIGT/a (20)/li
 /ul
 ul id=DOCUMENT/LAROSATE_more
lia href=javascript:toggle('DOCUMENT/
LAROSATE_more');Show less/a/li
 /ul
 /li


This is my javascript

function toggle(id) {
$(#+id).slideToggle(fast);
 }

id is passed in as DOCUMENT/LAROSATE_more but the selector doesn't
work, there is no toggle.

What could be wrong?



[jQuery] Re: Want to pass a variable to the selector

2009-03-25 Thread Jens Bengtsson

Found the problem, you can't use / in the name.

On Mar 25, 1:28 pm, Jens Bengtsson poserdo...@gmail.com wrote:
 This is my HTML

  liaDOCUMENT/LAROSATE/a (1)
 ul
  lia href=/Default.aspx?q=*amp;navigator=DOCUMENT/LAROSATE:0XD6
 VRIGT0XD6 VRIGT/a (20)/li
  /ul
  ul id=DOCUMENT/LAROSATE_more
         lia href=javascript:toggle('DOCUMENT/
 LAROSATE_more');Show less/a/li
  /ul
  /li

 This is my javascript

 function toggle(id) {
         $(#+id).slideToggle(fast);
  }

 id is passed in as DOCUMENT/LAROSATE_more but the selector doesn't
 work, there is no toggle.

 What could be wrong?


[jQuery] Re: Jquery UI 1.7.1 Tabs - Close open tab on mouseout from overall tab group

2009-03-25 Thread Richard D. Worth
You may want to ask on the jQuery UI list:

http://groups.google.com/group/jquery-ui

- Richard

On Wed, Mar 25, 2009 at 5:44 AM, jq noob sammil...@alliancecom.net wrote:


 I am currently using

 $(document).ready(function()
 {
 var $tabs = $(#tabs).tabs({
selected: -1,
event: 'mouseover',
collapsible: true
 });

 I have tried including a  .mouseout(function(){
//$tabs.tabs('option', 'selected', -1);
$tabs.tabs('select',-1);
}); // Used various combos of these

 I can see that a mouseout event is fired, when you leave the tab and
 move your mouse into the now showing div and another mouseout event is
 fired when you leave that div.

 What is the correct way to hide that div on mouseout and basically set
 the tab group back to nothing selected once your focus is no longer on
 that tab group?

 I found some posts from February 08 and September 08 but none of those
 solutions worked.

 I was thinking that I could bind something to the wrapper but not
 sure how or if that would even be the correct way.

 div class=wrapper

 div id=tabs
ul
lia href=#tabs-1Filter 1/a/li
lia href=#tabs-2Filter 2/a/li
lia href=#tabs-3Filter 3/a/li
/ul
div id=tabs-1html/div
div id=tabs-2html/div
div id=tabs-3html/div
 /div
 /div




[jQuery] Re: Two Sliders on Page :: 1 closes when the other opens

2009-03-25 Thread commarts

Mohd,

I'm a newbie to  javascript. Can you help me?

Here is a link to the site:  http://workit.637westmain.com/

Daniel

On Mar 25, 1:29 am, Mohd.Tareq tareq.m...@gmail.com wrote:
 Hi commarts,
 When you are writing script to open top right slider , at the same time you
 need to add script
 to close bottom slider in the same script.

 Hope you get it.

 Cheers.

 On Wed, Mar 25, 2009 at 1:35 AM, commarts comma...@gmail.com wrote:

  Friends,

  I have two sliders on the page. One at the top right, and one at the
  bottom right. I would like for them to work together. When one slider
  opens the other one closes.

  Daniel


[jQuery] Re: window unload event too slow - delay when navigate away from the page

2009-03-25 Thread johan . borestad

Hi!
If you have a lot of selectors, you should probably use Event
Delegation and wait for the event to bubble instead.
A good example is if you have a huge table and events on every row.
Instead of using $('table a').bind('click', function(){ alert('do
stuff!!') }) , you just bind ONE event on the table and listens for
all other events to happen (like click/mouseover/focus etc).

You may want to look at the new jQuery feature jQuery.live()
http://docs.jquery.com/Events/live

A very good plugin (I use it myself in some really huge projects) that
also solves a bug where IE6 doesn't bubble focus/blur events on some
elements is jquery.listen
http://plugins.jquery.com/project/Listen

Read more about Event delegation from here :)
http://www.google.se/search?hl=svq=event+delegation+javascriptbtnG=Google-s%C3%B6kningmeta=aq=0oq=

/ Johan


On 25 Mar, 05:42, Khoa nvkho...@gmail.com wrote:
 One of the pages I'm working on at the moment is quite big, it has a
 huge amount of HTML elements and many of them have events bound to
 them. So whenever I navigate out of that page, there is a huge delay.
 The browser seems to be freezing during that time. And then it loads
 the next page (the page that I go to).

 I notice that, this is because of the window unload event, which is
 specified in the source code at:

 jQuery( window ).bind( 'unload', function(){
         for ( var id in jQuery.cache )
                 // Skip the window
                 if ( id != 1  jQuery.cache[ id ].handle )
                         jQuery.event.remove( jQuery.cache[ id ].handle.elem );

 });

 Is there anyway that we can speed up this event? Maybe in the next
 release of jQuery? This snippet seems to take too much time to run on
 large page. If there is not, can I just remove it? Why do we need this
 function? Sorry, I'm still new to JS, so I'm don't know why we need
 this, please advise.

 Thanks.


[jQuery] Re: window unload event too slow - delay when navigate away from the page

2009-03-25 Thread johan . borestad

Typo error above, a lot of selectors should be a lot of events


[jQuery] Re: [autocomplete] jquery + dwr

2009-03-25 Thread Diego Plentz
Thanks Jörn. Btw, the problem still here, because even if I do something
like that:

$(#city).autocomplete({
source: handleDWR
});

function handleDWR(term){
  TestAutoComplete.findAutoComplete(term, function(data) {return data});
}

data never goes back to autocomplete to be properly rendered (because it
is a asynchronous call). What am I missing here?

Thanks again!

On Tue, Mar 24, 2009 at 7:36 PM, Jörn Zaefferer 
joern.zaeffe...@googlemail.com wrote:


 The jQuery UI branch of the autocomplete plugin supports a
 source-option as an alternative to the url- und data-options. Give it
 a try and let us know if it works for you:
 http://jquery-ui.googlecode.com/svn/branches/dev/autocomplete/
 http://jqueryui.pbwiki.com/SelectComboboxAutocomplete

 Jörn

 On Tue, Mar 24, 2009 at 10:39 PM, Diego Plentz diego.pi...@gmail.com
 wrote:
  Hey guys,
 
  I'm using jquery + autocomplete plugin (by Jörn) and I trying to make it
  work with DWR(http://directwebremoting.org/). My problem is that jquery
  autocomplete takes a url or data directly, but to make DWR works
 properly, I
  must use their javascript functions and handle the callback. Here is a
  example:
 
  TestAutoComplete.findAutoComplete(token, function(data) { /* do something
  with data*/ });
 
  How to make it work with autocomplete, that works like this:
 
  $(#city).autocomplete(cities);
 
  Thanks in advance
 
  --
  http://plentz.org
 




-- 
http://plentz.org


[jQuery] JQuery Editor

2009-03-25 Thread daniel8250

Hello,
I've recently worked with a freelancer that developed a jQuery plugin
for me, he did a good job, but unfortunately - he couldn't finish
it...
It is a RTE (Rich Text Editor) plugin (WYSIWYG - What you see is what
you get), which works pretty good, there are only a few bugs left that
needs to be fixed...
The code seems very readable and understandable, and well indented...
it is currently ~400 lines of code (16kb, when not packed/minified).
If there's anyone here with some knowledge in RTE's, that is willing
to take a look at the code and tell me if he can do it (I will pay, of
course) - I'd appreciate it.

Please mail me, if you can help.
Thanks,
Daniel


[jQuery] HowTo Select first two characters of an li and hide them

2009-03-25 Thread 262Rui

This is My markup

div class=multiple_options_caption Features/div
div class=multiple_options
ulli class=features11 Classic Designbr/li
li class=features14 Countryside Viewbr/li
li class=features17 Space for Swimming Poolbr/li
li class=features21 Garagebr/li
li class=features22 Spacious Garden br/li
li class=features24 Landscaped Gardenbr/li
li class=features27 BBQbr/li
li class=features29 Guest parking /li
/ul
/div

and i would like to hide/remove the first 2 numbers fom my li.features

How can this be achieved?
kind Regards

Rui


[jQuery] How to use ThickBox in asp.net pages?

2009-03-25 Thread Sachin

Hi,
I am new to using jquery and want to understand how i can implement
thickbox in my asp.net website.
Is there any one who can provide me a simple example?

Thanks in advance

Sachin


[jQuery] Re: HowTo Select first two characters of an li and hide them

2009-03-25 Thread johan . borestad

Something like this maybe

$('div.multiple_options li').each(function(){
  var text = $(this).html()
  $(this).html( text.replace(/\d+\s+/,'') )
})

But please remove that ugly br inside your li tags and make them
block elements instead to achieve the same effect.

/ Johan


On 25 Mar, 14:03, 262Rui i...@noiteglobal.com wrote:
 This is My markup

 div class=multiple_options_caption Features/div
 div class=multiple_options
 ulli class=features11 Classic Designbr/li
 li class=features14 Countryside Viewbr/li
 li class=features17 Space for Swimming Poolbr/li
 li class=features21 Garagebr/li
 li class=features22 Spacious Garden br/li
 li class=features24 Landscaped Gardenbr/li
 li class=features27 BBQbr/li
 li class=features29 Guest parking /li
 /ul
 /div

 and i would like to hide/remove the first 2 numbers fom my li.features

 How can this be achieved?
 kind Regards

 Rui


[jQuery] Re: [autocomplete] jquery + dwr

2009-03-25 Thread Jörn Zaefferer

Ah, sorry. source expects a synchronous return as well, doesn't help
at all in this case.

Jörn

On Wed, Mar 25, 2009 at 2:24 PM, Diego Plentz diego.pi...@gmail.com wrote:
 Thanks Jörn. Btw, the problem still here, because even if I do something
 like that:

 $(#city).autocomplete({
     source: handleDWR
 });

 function handleDWR(term){
   TestAutoComplete.findAutoComplete(term, function(data) {return data});
 }

 data never goes back to autocomplete to be properly rendered (because it
 is a asynchronous call). What am I missing here?

 Thanks again!

 On Tue, Mar 24, 2009 at 7:36 PM, Jörn Zaefferer
 joern.zaeffe...@googlemail.com wrote:

 The jQuery UI branch of the autocomplete plugin supports a
 source-option as an alternative to the url- und data-options. Give it
 a try and let us know if it works for you:
 http://jquery-ui.googlecode.com/svn/branches/dev/autocomplete/
 http://jqueryui.pbwiki.com/SelectComboboxAutocomplete

 Jörn

 On Tue, Mar 24, 2009 at 10:39 PM, Diego Plentz diego.pi...@gmail.com
 wrote:
  Hey guys,
 
  I'm using jquery + autocomplete plugin (by Jörn) and I trying to make it
  work with DWR(http://directwebremoting.org/). My problem is that jquery
  autocomplete takes a url or data directly, but to make DWR works
  properly, I
  must use their javascript functions and handle the callback. Here is a
  example:
 
  TestAutoComplete.findAutoComplete(token, function(data) { /* do
  something
  with data*/ });
 
  How to make it work with autocomplete, that works like this:
 
  $(#city).autocomplete(cities);
 
  Thanks in advance
 
  --
  http://plentz.org
 



 --
 http://plentz.org



[jQuery] Re: cluetip plugin issues

2009-03-25 Thread Karl Swedberg

Hi Adam,

If you want the content to be ajaxed in, then by default you need to  
use the rel attribute and set it to the file. you can override that by  
setting the attribute option to something else,  
e.g. .cluetip({attribute: 'href'});


hope that helps.

--Karl


Karl Swedberg
www.englishrules.com
www.learningjquery.com




On Mar 24, 2009, at 3:05 PM, Adam wrote:



I am trying to use the cluetip plugin to no avail.  Instead of the
cluetip coming up, I am taken to the website URL like a normal link.

I am using this within the Liferay portal and am using the livequery
plugin.  I've tried this with ajaxCache set to false and true.

The cluetip code is getting executed when the page loads - verified
with firebug.  Here is the cluetip related html that is written when
the cluetip code executes:

div id=cluetip-waitimage style=position: absolute; z-index: 95;
display: none;/
div id=cluetip style=z-index: 96; display: none; position:
absolute;div style=z-index: 90; opacity: 0.1; top: 6px; left: 6px;
position: absolute; background-color: rgb(0, 0, 0);/div style=z-
index: 91; opacity: 0.1; top: 5px; left: 5px; position: absolute;
background-color: rgb(0, 0, 0);/div style=z-index: 92; opacity:
0.1; top: 4px; left: 4px; position: absolute; background-color: rgb(0,
0, 0);/div style=z-index: 93; opacity: 0.1; top: 3px; left: 3px;
position: absolute; background-color: rgb(0, 0, 0);/div style=z-
index: 94; opacity: 0.1; top: 2px; left: 2px; position: absolute;
background-color: rgb(0, 0, 0);/div style=z-index: 95; opacity:
0.1; top: 1px; left: 1px; position: absolute; background-color: rgb(0,
0, 0);/div id=cluetip-outer style=position: relative; z-index:
97;h3 id=cluetip-title/div id=cluetip-inner//divdiv
id=cluetip-extra/div class=cluetip-arrows id=cluetip-arrows
style=z-index: 97;//div



Here is my relevant code:

jQuery(a.hTip).livequery(function() {
jQuery(this).cluetip();
});


a href=someurl class=hTip title=the titleTest Me/a




[jQuery] Re: HowTo Select first two characters of an li and hide them

2009-03-25 Thread info


Tank you so much for both tips
- Original Message - 
From: johan.bores...@gmail.com

To: jQuery (English) jquery-en@googlegroups.com
Sent: Wednesday, March 25, 2009 2:07 PM
Subject: [jQuery] Re: HowTo Select first two characters of an li and hide 
them





Something like this maybe

$('div.multiple_options li').each(function(){
 var text = $(this).html()
 $(this).html( text.replace(/\d+\s+/,'') )
})

But please remove that ugly br inside your li tags and make them
block elements instead to achieve the same effect.

/ Johan


On 25 Mar, 14:03, 262Rui i...@noiteglobal.com wrote:

This is My markup

div class=multiple_options_caption Features/div
div class=multiple_options
ulli class=features11 Classic Designbr/li
li class=features14 Countryside Viewbr/li
li class=features17 Space for Swimming Poolbr/li
li class=features21 Garagebr/li
li class=features22 Spacious Garden br/li
li class=features24 Landscaped Gardenbr/li
li class=features27 BBQbr/li
li class=features29 Guest parking /li
/ul
/div

and i would like to hide/remove the first 2 numbers fom my li.features

How can this be achieved?
kind Regards

Rui







[jQuery] Re: .load of content does not always include DB connection

2009-03-25 Thread Tim

Unfortunately it's in a cms, that I can't really expose. My host
company is looking at the problem as I expect there are server issues.

Tim

On Mar 24, 5:49 pm, James james.gp@gmail.com wrote:
 This sounds more like a server-side issue. Are you running into 
 highloadissues on yourdatabase, or some kind of connection limit?
 Every AJAX request is just a single request and are completely
 separate of each request and the page that it's called from.
 Do you have some kind of demo page that we can look at?

 On Mar 24, 12:58 pm, Tim tim.myer...@gmail.com wrote:

  I have a website where I pull a lot of different pages into one CMS
  page. The problem is the loaded page will occasionaly say Nodatabase
  selected. But if I click the link andloadthe page again the content
  will show correctly.

  Is there a way to check if connection has been made or a way to delay
  theloadby milliseconds?

  Thanks.


[jQuery] Re: Intelisense in VS2008

2009-03-25 Thread MorningZ

Without more code it's hard to help, but I could venture a guess that
where you are in your code that Intellisense has no idea what the type
of variable/object event is

to help understand that, take this sample:

var s;

if you went to do something with s, the compiler has no idea what
kind of object s is... so typing s. results in no Intellisense

now, if you said:

var s = '';

then typing s. results in all the things you can do to a string

saying:

var s = 0;

results in Intellisense for numeric objects

So if Studio has no idea what event is (and this is your code that
needs to specify it!!), then it can't provide help




On Mar 25, 5:38 am, simonxy enki...@gmail.com wrote:
 Hi, I copied jquery-1.3.2.js and jquery-1.3.2-vsdoc.js files into the
 same directory and intelisense works, but not in complete. For
 example, I don't have almost any properties and methods of event
 object, like event.stopPropagation() or event.isPropagationStopped()
 and similar.
 Why intelisense of event object doesn't work?

 Thank you for your answer,
 Simon


[jQuery] Re: Convert js to jquery

2009-03-25 Thread mdjamal

Hi Richard,

Thanks for your help, the tabs switch the class on click, but how to
get the value assigned to the hidden field?

Regards,

Jamal


[jQuery] slide/scroller to top

2009-03-25 Thread introvert

Hello

How is it possible to slide scrollbar to the top with jquery?

Thanks a lot for help!


[jQuery] Re: Convert js to jquery

2009-03-25 Thread Richard D. Worth
var val = $(#searchopt).val();

On Wed, Mar 25, 2009 at 9:38 AM, mdjamal mail4ja...@gmail.com wrote:


 Hi Richard,

 Thanks for your help, the tabs switch the class on click, but how to
 get the value assigned to the hidden field?

 Regards,

 Jamal


[jQuery] Thickbox half-works.

2009-03-25 Thread Devin

This is my code.   The problem I'm having is that when I click the
thumbnail all I see the loading bar.  It just hangs there animated.
Interestingly if I take the rel tag out of the images it works, but it
doesn't show the previous and next options in the thickbox.

Suggestions?


!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN
html
  head
  script type=text/javascript src=thickbox/js/jquery-latest.js/
script
script type=text/javascript src=thickbox/js/thickbox-
compressed.js/script
link rel=stylesheet href=styles/thickbox.css type=text/css
media=screen /
  meta http-equiv=content-type content=text/html;
charset=windows-1250

  titleLab6b - jquery/title
  /head

  body
a href=images/plant1.jpg title=add a caption to title attribute /
or leave blank class=thickbox rel=gallery-plantsimg src=images/
plant1_t.jpg alt=Plant 1 //a
a href=images/plant2.jpg title=add a caption to title attribute /
or leave blank class=thickbox rel=gallery-plantsimg src=images/
plant2_t.jpg alt=Plant 2 //a
a href=images/plant3.jpg title=add a caption to title attribute /
or leave blank class=thickbox rel=gallery-plantsimg src=images/
plant3_t.jpg alt=Plant 3 //a
a href=images/plant4.jpg title=add a caption to title attribute /
or leave blank class=thickbox rel=gallery-plantsimg src=images/
plant4_t.jpg alt=Plant 4 //a
  /body
/html


[jQuery] aborting a $.getScript() request

2009-03-25 Thread Maujor


I have the following AJAX request.

$(document).ready(function() {
var iconLoading = $(' mini.gif ');
var pluginLoaded = $('Plugin ready');

var requestScript = function() {
$(iconLoading).insertAfter('#my_button');
$.getScript('http://www.domain.com/jquery.corner.js', 
function() {
$(iconLoadind).hide();
$(pluginLoaded).insertAfter('#my_button')
.css({background: '#ffc', padding:'3px 5px'})
.fadeOut(3000);
// do something using the just loaded plugin
});
});
};
$('#my_button').bind('click', requestScript);
})

Suppose the requested script is unavailable.
How do I set a time interval in order to abort the request? 


-
Maurício Samy Silva
-- 
View this message in context: 
http://www.nabble.com/aborting-a-%24.getScript%28%29-request-tp22703190s27240p22703190.html
Sent from the jQuery General Discussion mailing list archive at Nabble.com.



[jQuery] Re: Need some help with a image opacity thingy.

2009-03-25 Thread Karl Swedberg

Hi there,

You could use the hoverIntent plugin or update the script with  
suggestions posted here:


http://www.learningjquery.com/2009/01/quick-tip-prevent-animation-queue-buildup

--Karl


Karl Swedberg
www.englishrules.com
www.learningjquery.com




On Mar 25, 2009, at 8:00 AM, MindTooth wrote:



Hello.

Please take a look at this code:
[code]  $(.box img).fadeTo(500, 0.6); // This sets 
the opacity
of the thumbs to fade down to 60% when the page loads

$(.box img).hover(function(){
$(this).fadeTo(normal, 1.0); // This 
should set the opacity to
100% on hover
},function(){
$(this).fadeTo(slow, 0.6); // This should set 
the opacity
back to 60% on mouseout

})[/code]

The problem I experience is that when I hover the images several times
in a row. They blink as many times as I have hovered them.
Appreciated if someone could direct me to a solution.


Birger :)




[jQuery] Re: How to use ThickBox in asp.net pages?

2009-03-25 Thread MorningZ

What do you feel the difference would be from their provided examples?

http://jquery.com/demo/thickbox/

it's looking for img tags with the class of thichbox

so if you had

img class=thickbox .. /

or

asp:image runat=server cssclass=thickbox .. /

it wouldn't matter to the thickbox code

On Mar 25, 8:24 am, Sachin yargatti...@gmail.com wrote:
 Hi,
 I am new to using jquery and want to understand how i can implement
 thickbox in my asp.net website.
 Is there any one who can provide me a simple example?

 Thanks in advance

 Sachin


[jQuery] attr(href) giving full path instead of relative in IE

2009-03-25 Thread Shane Riley

I'm wanting to read in the exact string that's contained in an
anchor's href attribute in order to use it as the POST variable list
for an Ajax call to a PHP script, however in IE6 and 7 the string read
from the href attribute ends up being the absolute path, not just the
href attribute. Here's exactly what's happening:

vars = $(a).attr(href);
alert(vars);

a href=page=2This should return page=2/a

What I get when running locally in all browsers but IE is what is
expected, an alert box with page=2 in it. In IE, I get http://
localhost/page=2. Is there some way to get it to behave either one
way or the other in all browser instances? I really don't want to have
to detect for IE, then extract what I want from the string if it is.


[jQuery] Re: attr(href) giving full path instead of relative in IE

2009-03-25 Thread Martijn Houtman


On Mar 25, 2009, at 4:32 PM, Shane Riley wrote:



I'm wanting to read in the exact string that's contained in an
anchor's href attribute in order to use it as the POST variable list
for an Ajax call to a PHP script, however in IE6 and 7 the string read
from the href attribute ends up being the absolute path, not just the
href attribute. Here's exactly what's happening:

vars = $(a).attr(href);
alert(vars);

a href=page=2This should return page=2/a

What I get when running locally in all browsers but IE is what is
expected, an alert box with page=2 in it. In IE, I get http://
localhost/page=2. Is there some way to get it to behave either one
way or the other in all browser instances? I really don't want to have
to detect for IE, then extract what I want from the string if it is.


http://www.glennjones.net/Post/809/getAttributehrefbug.htm describes  
the issue and gives a solution.


$(a)[0].href will probably work consistently.

Regards,
--
Martijn.


[jQuery] simplemodal help - dynamic load of modal content breaks close button

2009-03-25 Thread dbonneville

I have an include that contains all the HTML for the modal dialogue
content. In the HTML, I also have a close button with the class
simplemodal-close attached to it, which triggers the close function.
That works great.

However, I decided to load the snippet via jquery.get. It loads in
just fine. But now, the close button with the simplemodal-close
class on it will now not trigger the event.

Is this because the button with the class on it was loaded AFTER the
script was loaded? How can I make the button work?

Nothing in the HTML include or HTML snipped loaded through get are
any different. When I compare pages in Firebug, the include version
and the get version are identical in all respects.

What do I need to do to the button AFTER its loaded via jquery.get to
make it aware that it has the class on it?


[jQuery] Re: jQuery.preload - Getting Link Mode To Work

2009-03-25 Thread Nic Hubbard

Thank you!

This did the trick.

I didn't realize that how I had it would only load up the first
match.

I appreciate the help!

On Mar 24, 6:05 pm, James james.gp@gmail.com wrote:
 Try replacing this line:
 var $links = $('#artistsColumns a').attr('rel');

 with:
 var $links = [];
 $.each($('#artistsColumns a'), function() {
      $links.push( $(this).attr('rel') );

 });

 $('#artistsColumns a').attr('rel'); only gives you one string value,
 thus it will only preload one url.
 I made it loop through the matching jQuery set and put all the rel
 values into an array, which you use for preloading.

 On Mar 24, 1:19 pm, Nic Hubbard nnhubb...@gmail.com wrote:

  Anyone?

  On Mar 23, 2:08 pm, Nic Hubbard nnhubb...@gmail.com wrote:

   I seem to be having issues with getting link mode to work with Ariel
   Flesler's preload plugin.  I have a hidden menu, which shows a hidden
   div when you mouse over a nav item.  This then shows a list of names,
   and I am using the preload plugin to load up a thumbnail image for
   each of the names.  Currently, it does not seem to be preloading, as
   running your mouse over each name takes a few seconds for the image to
   load.  So, for some reason,  it seems like they are not getting
   preloaded.

   And ideas on why this would be?  Did I implement the plugin wrong for
   link mode?

   Code:
   // - Artists Menu: Show Artist Preview Image -
           var $links = $('#artistsColumns a').attr('rel');
           var $preview = $('#artist_menu_artwork');

           $.preload($links,
                   {
                           threshold: 2

                   }
           );

           $('#artistsColumns a').mouseover(function(){
                   $preview.attr('src', $(this).attr('rel'));
           });

   Link:http://67.207.148.241/home
   (Move your mouse over the Artists top nav)


[jQuery] Re: attr(href) giving full path instead of relative in IE

2009-03-25 Thread Shane Riley

Thanks for the article link, but your proposed change isn't valid
JQuery, is it? My exact jQuery code to read in the value looks like
this:
pageID = $(this).attr(href);
Adding what you suggested to make it $(this)[0].attr(href) will not
do anything apart from force the link to be followed.

I think I'm going to have to move the contents of href to rel instead.

On Mar 25, 11:43 am, Martijn Houtman martijn.hout...@gmail.com
wrote:
 On Mar 25, 2009, at 4:32 PM, Shane Riley wrote:





  I'm wanting to read in the exact string that's contained in an
  anchor's href attribute in order to use it as the POST variable list
  for an Ajax call to a PHP script, however in IE6 and 7 the string read
  from the href attribute ends up being the absolute path, not just the
  href attribute. Here's exactly what's happening:

  vars = $(a).attr(href);
  alert(vars);

  a href=page=2This should return page=2/a

  What I get when running locally in all browsers but IE is what is
  expected, an alert box with page=2 in it. In IE, I get http://
  localhost/page=2. Is there some way to get it to behave either one
  way or the other in all browser instances? I really don't want to have
  to detect for IE, then extract what I want from the string if it is.

 http://www.glennjones.net/Post/809/getAttributehrefbug.htmdescribes  
 the issue and gives a solution.

 $(a)[0].href will probably work consistently.

 Regards,
 --
 Martijn.


[jQuery] one check box to select entire group

2009-03-25 Thread Andy

Hey guys,

I have a table where the header has check boxes so if you click on
that, it will select all of the other checkboxes in that row.   The
issue I have, it's not a select all checkboxes, but ones that have a
specific naming convention.   Example.  If my header is named
ckb_category1 I need to be able to find all checkboxes that are in
that column that have naming like ckb_category1_item1.  Then each row
following would have a different item id, but keep the category1 the
same.   Is there a pattern I can use that would work for this?

Thanks!



[jQuery] Re: attr(href) giving full path instead of relative in IE

2009-03-25 Thread Martijn Houtman

On Mar 25, 2009, at 5:04 PM, Shane Riley wrote:


Thanks for the article link, but your proposed change isn't valid
JQuery, is it? My exact jQuery code to read in the value looks like
this:
pageID = $(this).attr(href);
Adding what you suggested to make it $(this)[0].attr(href) will not
do anything apart from force the link to be followed.


Well, no. I suggested using:

pageID = $(this)[0].attr;

This is plain JavaScript, rather than using jQuery's attr() function.  
As the article suggests, this works cross-browser.



I think I'm going to have to move the contents of href to rel instead.


Well, you could, but I wouldn't; this is not what the rel attribute  
is meant for. Besides, it would break the anchor when JavaScript is  
turned off.


Regards,
--
Martijn.

[jQuery] Re: attr(href) giving full path instead of relative in IE

2009-03-25 Thread Shane Riley

Ha! I looked at your post too fast, and didn't notice that it was pure
Javascript. Sorry. I'll try it and see.

The way I currently have it will not work with javascript turned off
either. I'm doing it this way only because the client is requiring the
user to have Javascript enabled to use the site (it's a backend system
for very specific clients). They want to add all sorts of animations
and effects like everyone wants to do once they see JQuery animations
in action.

On Mar 25, 12:14 pm, Martijn Houtman martijn.hout...@gmail.com
wrote:
 On Mar 25, 2009, at 5:04 PM, Shane Riley wrote:

  Thanks for the article link, but your proposed change isn't valid
  JQuery, is it? My exact jQuery code to read in the value looks like
  this:
  pageID = $(this).attr(href);
  Adding what you suggested to make it $(this)[0].attr(href) will not
  do anything apart from force the link to be followed.

 Well, no. I suggested using:

 pageID = $(this)[0].attr;

 This is plain JavaScript, rather than using jQuery's attr() function.  
 As the article suggests, this works cross-browser.

  I think I'm going to have to move the contents of href to rel instead.

 Well, you could, but I wouldn't; this is not what the rel attribute  
 is meant for. Besides, it would break the anchor when JavaScript is  
 turned off.

 Regards,
 --
 Martijn.


[jQuery] Re: Need some help with a image opacity thingy.

2009-03-25 Thread MindTooth

Thank you so much. That fixed it completely.

Just asking, could you provide some info regarding IE compatible.
Since now my PNGs has rough edges. Looks life som chaiw saw blades.

Birger :)

On Mar 25, 3:52 pm, Karl Swedberg k...@englishrules.com wrote:
 Hi there,

 You could use the hoverIntent plugin or update the script with  
 suggestions posted here:

 http://www.learningjquery.com/2009/01/quick-tip-prevent-animation-que...

 --Karl

 
 Karl Swedbergwww.englishrules.comwww.learningjquery.com

 On Mar 25, 2009, at 8:00 AM, MindTooth wrote:





  Hello.

  Please take a look at this code:
  [code]                             $(.box img).fadeTo(500, 0.6); // 
  This sets the opacity
  of the thumbs to fade down to 60% when the page loads

                             $(.box img).hover(function(){
                                     $(this).fadeTo(normal, 1.0); // This 
  should set the opacity to
  100% on hover
                             },function(){
                             $(this).fadeTo(slow, 0.6); // This should set 
  the opacity
  back to 60% on mouseout

     })[/code]

  The problem I experience is that when I hover the images several times
  in a row. They blink as many times as I have hovered them.
  Appreciated if someone could direct me to a solution.

  Birger :)


[jQuery] Re: IE7 returning 0 for attr(width) on an img with width set

2009-03-25 Thread nabrown78

Aha! The problem was that the li elements which contained the images
were set to display:none in the CSS. I guess I can work around that.

On Mar 25, 10:47 am, nabrown78 nabrow...@gmail.com wrote:
 Hi All, I have the following code:

 $('#slides img').each(function(i){//calculate margins and wrap
                 var this_img = $(this);
                 var imgMargin = Math.round((550 - (this_img.attr(width) + 
 35))/2)
 + 5;
                 this_img.wrap('div class=wrap0 style=margin-left:' + 
 imgMargin +
 'pxdiv class=wrap1div class=wrap2div class=wrap3/div/
 div/div/div');
                 $('#content').append('p'+imgMargin+'/p');
         });

 On this page:http://www.colleenkiely.com/testLayout2003-2006.htm

 In Firefox and Safari the margin is correctly set. In IE7, the margin
 is calculated as if this_img.attr(width) were 0. The html markup has
 the height and width of each img set explicitly:

 img src=http://www.colleenkiely.com/site_images/2.jpg; height=510
 width=507 alt=Dog with Egg Hat (#2) /

 I am using the latest JQuery - 1.3.2.

 Any insight into this mystery sincerely appreciated.


[jQuery] Re: one check box to select entire group

2009-03-25 Thread MorningZ

Your description of your HTML isn't very clear, but none the less this
could work:

$(selector for header checkboxes).click(function() {
  var chk = this;
  $(input[id^=' + chk.id + _item']).each(function()
{ this.checked = chk.checked; });
})

On Mar 25, 12:12 pm, Andy adharb...@gmail.com wrote:
 Hey guys,

 I have a table where the header has check boxes so if you click on
 that, it will select all of the other checkboxes in that row.   The
 issue I have, it's not a select all checkboxes, but ones that have a
 specific naming convention.   Example.  If my header is named
 ckb_category1 I need to be able to find all checkboxes that are in
 that column that have naming like ckb_category1_item1.  Then each row
 following would have a different item id, but keep the category1 the
 same.   Is there a pattern I can use that would work for this?

 Thanks!


[jQuery] Re: Need some help with a image opacity thingy.

2009-03-25 Thread MindTooth

Thank you so much. That fixed it completely. Much appreciated.

Just asking, could you provide some info regarding IE compatible.
Since now my PNGs has rough edges. Looks like som chainsaw blades.

Birger :)

On Mar 25, 3:52 pm, Karl Swedberg k...@englishrules.com wrote:
 Hi there,

 You could use the hoverIntent plugin or update the script with  
 suggestions posted here:

 http://www.learningjquery.com/2009/01/quick-tip-prevent-animation-que...

 --Karl

 
 Karl Swedbergwww.englishrules.comwww.learningjquery.com

 On Mar 25, 2009, at 8:00 AM, MindTooth wrote:





  Hello.

  Please take a look at this code:
  [code]                             $(.box img).fadeTo(500, 0.6); // 
  This sets the opacity
  of the thumbs to fade down to 60% when the page loads

                             $(.box img).hover(function(){
                                     $(this).fadeTo(normal, 1.0); // This 
  should set the opacity to
  100% on hover
                             },function(){
                             $(this).fadeTo(slow, 0.6); // This should set 
  the opacity
  back to 60% on mouseout

     })[/code]

  The problem I experience is that when I hover the images several times
  in a row. They blink as many times as I have hovered them.
  Appreciated if someone could direct me to a solution.

  Birger :)


[jQuery] Re: IE7 returning 0 for attr(width) on an img with width set

2009-03-25 Thread MorningZ

Use

this_img.width()

instead

http://docs.jquery.com/CSS/width

On Mar 25, 11:47 am, nabrown78 nabrow...@gmail.com wrote:
 Hi All, I have the following code:

 $('#slides img').each(function(i){//calculate margins and wrap
                 var this_img = $(this);
                 var imgMargin = Math.round((550 - (this_img.attr(width) + 
 35))/2)
 + 5;
                 this_img.wrap('div class=wrap0 style=margin-left:' + 
 imgMargin +
 'pxdiv class=wrap1div class=wrap2div class=wrap3/div/
 div/div/div');
                 $('#content').append('p'+imgMargin+'/p');
         });

 On this page:http://www.colleenkiely.com/testLayout2003-2006.htm

 In Firefox and Safari the margin is correctly set. In IE7, the margin
 is calculated as if this_img.attr(width) were 0. The html markup has
 the height and width of each img set explicitly:

 img src=http://www.colleenkiely.com/site_images/2.jpg; height=510
 width=507 alt=Dog with Egg Hat (#2) /

 I am using the latest JQuery - 1.3.2.

 Any insight into this mystery sincerely appreciated.


[jQuery] why does load cost so much time?

2009-03-25 Thread Samuel
Hi,

recently I changed my ajax returned content format to html pieces, using a
load() function with an expect of time decreasing used for dom manipulation.

On the contract, it could be even longer than the previous xml processing
time.

After a debugging with firebug, I found the function data() consumes most of
time, 90% of the total one. Here's a quick illustration:

data()16585.59%457.185ms457.185ms2.771ms0.007ms11.215msjquery.js (line 658)
ajax()12.86%15.267ms17.361ms17.361ms17.361ms17.361msjquery.js (line 2583)
fix()11.89%10.122ms10.122ms10.122ms10.122ms10.122msjquery.js (line 2092)
merge()291.6%8.554ms8.554ms0.295ms0.003ms6.079msjquery.js (line 1155)
classFilter()61.5%8.008ms8.008ms1.335ms0.012ms4.04msjquery.js (line 1657)
remove()30.85%4.524ms451.542ms150.514ms7.582ms332.348msjquery.js (line 1310)
remove()710.8%4.268ms428.967ms6.042ms6.166ms7.32msjquery.js (line 1908)(?)()
20.68%3.633ms4.378ms2.189ms0.116ms4.262msjquery.js (line 947)find()140.52%
2.751ms19.985ms1.428ms0.14ms10.527msjquery.js (line 1464)append()50.35%
1.843ms1.843ms0.369ms0.04ms1.186msjquery.js (line 237)removeData()1060.34%
1.793ms1.793ms0.017ms0.011ms0.318msjquery.js (line 684)init()580.32%1.711ms
24.058ms0.415ms0ms10.864ms
data() function consumed as much as 85% of time, strikingly beyond of my
expectation which should be less than 100ms.

some code:


renderLearning=function(nextUrl,node) {

$('.words').load(nextUrl,function () {

var word=$('#words h1').text();
$('#next_word').click(function () {
renderLearning($('#next_word').attr('href'));
return false;
})
$('#prev_word').click(function () {
renderLearning($('#prev_word').attr('href'));
return false;
})
 })
}

your helps are highly appreciated. Thanks very much.

Regards,
-- 
Samuel(吴焱红)
Blog:http://wuyanhong.blogspot.com


[jQuery] Attribute selector

2009-03-25 Thread Lay András

Hello!

I'd like to set a css property on every table, that have
style=table-layout: fixed attribute. I tried this, but don't works:

$('table[style=table-layout: fixed]').css('background-color','#DD');

With id attribute works:

$('table[id=mytable]').css('background-color','#DD');

But i don't want to add id-s in tables. How can i solve this like first example?

Thanks you!

Lay


[jQuery] Re: scrollto function works with static html, but not with identical generated html

2009-03-25 Thread ryan

i forgot to mention that the temporary scroll button i've set up is a
h1scroll down test/h1 in the lower right.
i apologize if i'm missing something really obvious here, but really
don't understand how javascript can operate differently on two html
pages that appears to me to be identical.
- r

On Mar 25, 2:48 am, ryan ryanr...@gmail.com wrote:
 hi all -

 i'm just trying to scroll an iframe without a big standard scrollbar,
 but have run into a confusing problem: i'm able to scrollstatichtml
 pages loaded in the iframe fine, but for some reason am unable to
 scroll pages that have been generated by drupal or blogger in firefox.
 (safari works fine).

 my test page is athttp://nickzmusic.com/nick.htmlnote the two nav
 links at the top to two identical pages (one static one generated).
 one works and one doesn't. any ideas as to why?

 thanks in advance everyone, and especially to ariel flesler!

 peace.
 -ryan


[jQuery] Multiple AJAX requests using jQuery

2009-03-25 Thread jakenoble

Hi

I am trying to use jQuery's AJAX functionality to make a progress bar.

A request is submited via AJAX, which starts importing data to a
database. Once submited another AJAX request is called on an interval
which checks the progress of this import, a progress meter is then
updated using this information.

However, the progress AJAX call which is fired on the submit of the
form only returns once the import has complete. Its like its being
blocked by the initial request?

Can anyone explain whats going on here and/or how I can get both calls
to work at the same time?

Thanks

Jake


[jQuery] Re: HowTo Select first two characters of an li and hide them

2009-03-25 Thread benjamin.josefus

 li class=features22 Spacious Garden br/li

Why don't you put the Metadata into one of the appropriate attributes
like id?
If you do so, any of  your li Element is addressed by that and
could easily be handled.

And please don't use the br if there's no proper use for it


[jQuery] looping through json and adding dom elements (options)

2009-03-25 Thread iceangel89

i am new to jquery and what i intend to do now is to load json from
server and then based on the json, remove all options from a drop down
and populate it with new items from the json. something like a
cascading drop down.

i dunno if the json outputted is correct? do i need something like
department: ['xxx', 'yyy', 'zzz']

[
{Value: 1, Item: Physics},
{Value: 2, Item: Chemistry},
{Value: 3, Item: Biology}
]

then i want to remove all option from a drop down then populate it
with something like

option value=1Physics/option
option value=2Chemistry/option
option value=3Biology/option

if possible, it will be good if i can have a default null option eg
Please select an option that does not do anything if the user
selects it or shows at the start and disappears once user selects it?
whats the best way of having this default value? i think its very
common.


[jQuery] IE7 returning 0 for attr(width) on an img with width set

2009-03-25 Thread nabrown78

Hi All, I have the following code:

$('#slides img').each(function(i){//calculate margins and wrap
var this_img = $(this);
var imgMargin = Math.round((550 - (this_img.attr(width) + 
35))/2)
+ 5;
this_img.wrap('div class=wrap0 style=margin-left:' + 
imgMargin +
'pxdiv class=wrap1div class=wrap2div class=wrap3/div/
div/div/div');
$('#content').append('p'+imgMargin+'/p');
});

On this page: http://www.colleenkiely.com/testLayout2003-2006.htm

In Firefox and Safari the margin is correctly set. In IE7, the margin
is calculated as if this_img.attr(width) were 0. The html markup has
the height and width of each img set explicitly:

img src=http://www.colleenkiely.com/site_images/2.jpg; height=510
width=507 alt=Dog with Egg Hat (#2) /

I am using the latest JQuery - 1.3.2.

Any insight into this mystery sincerely appreciated.


[jQuery] Jquery Tabs shown Horizontally in Firefox but shown Vertically in IE...?

2009-03-25 Thread Martin

Hello,

I am using Jquery Tabs in a webpage and the problem I am having is
that the tabs are shown correctly in Firefox (Horizontally), but
incorrectly in IE (Vertically).  Does anyone know a simple solution to
this problem?

My html is very vanilla (see below)

div id=tabs
ul class=holder
lia class=tabOne href=#tabs-1Tab 1 Title/a/li
lia class=tabTwo href=#tabs-2Tab 2 Title/a/li
/ul

div id=tabs-1
p Tab 1 /p
/div !-- End of Tab 1 --

div id=tabs-2
p Tab 2 /p
/div !-- End of Tab 2 --

/div!-- End of Tabs --

How can I get the tabs in IE to be shown vertically.  I assumed it was
a width issue, associated with the a links, but that didnt make much
difference...

Regards

Martin Ikediashi


[jQuery] Re: Attribute selector

2009-03-25 Thread Karl Swedberg

Hi Lay,

You could do it like this:

$('table').filter(function() {
   return this.style.tableLayout == 'fixed';
});

Not sure what happens when you try it in a browser that doesn't  
support the tableLayout property, though.



--Karl


Karl Swedberg
www.englishrules.com
www.learningjquery.com




On Mar 25, 2009, at 10:28 AM, Lay András wrote:



Hello!

I'd like to set a css property on every table, that have
style=table-layout: fixed attribute. I tried this, but don't works:

$('table[style=table-layout: fixed]').css('background- 
color','#DD');


With id attribute works:

$('table[id=mytable]').css('background-color','#DD');

But i don't want to add id-s in tables. How can i solve this like  
first example?


Thanks you!

Lay




[jQuery] Re: HowTo Select first two characters of an li and hide them

2009-03-25 Thread info


Im working on the frontend of an old proprietary system that trows those br 
/ before closing the li so i dont have a way to change that ...



- Original Message - 
From: benjamin.josefus b...@jfoot.de

To: jQuery (English) jquery-en@googlegroups.com
Sent: Wednesday, March 25, 2009 2:38 PM
Subject: [jQuery] Re: HowTo Select first two characters of an li and hide 
them






li class=features22 Spacious Garden br/li


Why don't you put the Metadata into one of the appropriate attributes
like id?
If you do so, any of  your li Element is addressed by that and
could easily be handled.

And please don't use the br if there's no proper use for it






[jQuery] Re: why does load cost so much time?

2009-03-25 Thread Samuel
supplement more information on the issue.

$('.words') have html data, ie, this node is not empty, so it must cost some
time to remove the children.

I made tens of tests, and the average of data() function time is around
500ms, which must be too high.

It's possible for me to use a iframe to process this if load() usually
consume so much time. the iframe costs around 120ms, which time for
ajax(get) in jquery is around 100ms. so only another 20ms used for redering
css in iframe without js codes added, which might cost a little more loading
and examining time.

I need to treat  the time as a very critical factor, so there is no
negotiation on the time.

Any suggestion on how to improve the speed is hugely expected, but your
suggestions are iframe are also strikingly hoped.

Thanks again.



On Thu, Mar 26, 2009 at 12:42 AM, Samuel samuel.yh...@gmail.com wrote:

 Hi,

 recently I changed my ajax returned content format to html pieces, using a
 load() function with an expect of time decreasing used for dom manipulation.

 On the contract, it could be even longer than the previous xml processing
 time.

 After a debugging with firebug, I found the function data() consumes most
 of time, 90% of the total one. Here's a quick illustration:

 data()16585.59%457.185ms457.185ms 2.771ms0.007ms11.215msjquery.js (line
 658)ajax() 12.86%15.267ms17.361ms17.361ms17.361ms17.361msjquery.js (line
 2583) fix()11.89%10.122ms10.122ms10.122ms10.122ms 10.122msjquery.js (line
 2092)merge() 291.6%8.554ms8.554ms0.295ms0.003ms6.079msjquery.js (line
 1155) classFilter()61.5%8.008ms8.008ms1.335ms 0.012ms4.04msjquery.js (line
 1657)remove() 30.85%4.524ms451.542ms150.514ms7.582ms332.348msjquery.js
 (line 1310) remove()710.8%4.268ms428.967ms6.042ms 6.166ms7.32msjquery.js
 (line 1908)(?)() 20.68%3.633ms4.378ms2.189ms0.116ms4.262msjquery.js (line
 947) find()140.52%2.751ms19.985ms1.428ms0.14ms 10.527msjquery.js (line
 1464)append() 50.35%1.843ms1.843ms0.369ms0.04ms1.186msjquery.js (line 237)
 removeData()1060.34%1.793ms1.793ms0.017ms 0.011ms0.318msjquery.js (line
 684)init() 580.32%1.711ms24.058ms0.415ms0ms10.864ms
 data() function consumed as much as 85% of time, strikingly beyond of my
 expectation which should be less than 100ms.

 some code:


 renderLearning=function(nextUrl,node) {

 $('.words').load(nextUrl,function () {

 var word=$('#words h1').text();
 $('#next_word').click(function () {
 renderLearning($('#next_word').attr('href'));
 return false;
 })
 $('#prev_word').click(function () {
 renderLearning($('#prev_word').attr('href'));
 return false;
 })
  })
 }

 your helps are highly appreciated. Thanks very much.

 Regards,
 --
 Samuel(吴焱红)
 Blog:http://wuyanhong.blogspot.com




-- 
Samuel(吴焱红)
Blog:http://wuyanhong.blogspot.com


[jQuery] Re: attr(href) giving full path instead of relative in IE

2009-03-25 Thread Karl Swedberg

Hi Shane,

IE has a second flag argument for getAttribute that, when set to 2,  
is supposed to get the literal value of the attribute rather than  
their special-sauce value.


So, this.getAttribute('href', 2) *should* get the relative href.  
(note: no need to do $(this)[0] ; this works just fine)


jQuery uses that flag internally, so .attr('href') should do the same  
thing:


var attr = !jQuery.support.hrefNormalized  notxml  
special
// Some attributes require a special 
call on IE
? elem.getAttribute( name, 2 )
: elem.getAttribute( name );

I believe that this works in every case except when the href is set  
via JavaScript. In that case, I'm not sure anything can be done.



--Karl


Karl Swedberg
www.englishrules.com
www.learningjquery.com




On Mar 25, 2009, at 12:21 PM, Shane Riley wrote:



Ha! I looked at your post too fast, and didn't notice that it was pure
Javascript. Sorry. I'll try it and see.

The way I currently have it will not work with javascript turned off
either. I'm doing it this way only because the client is requiring the
user to have Javascript enabled to use the site (it's a backend system
for very specific clients). They want to add all sorts of animations
and effects like everyone wants to do once they see JQuery animations
in action.

On Mar 25, 12:14 pm, Martijn Houtman martijn.hout...@gmail.com
wrote:

On Mar 25, 2009, at 5:04 PM, Shane Riley wrote:


Thanks for the article link, but your proposed change isn't valid
JQuery, is it? My exact jQuery code to read in the value looks like
this:
pageID = $(this).attr(href);
Adding what you suggested to make it $(this)[0].attr(href) will  
not

do anything apart from force the link to be followed.


Well, no. I suggested using:

pageID = $(this)[0].attr;

This is plain JavaScript, rather than using jQuery's attr() function.
As the article suggests, this works cross-browser.

I think I'm going to have to move the contents of href to rel  
instead.


Well, you could, but I wouldn't; this is not what the rel attribute
is meant for. Besides, it would break the anchor when JavaScript is
turned off.

Regards,
--
Martijn.




[jQuery] Re: IE7 returning 0 for attr(width) on an img with width set

2009-03-25 Thread MorningZ

yeah,   .width() gets or sets the computed width

so in your case, grabbing the attribute makes more sense for your
situation

On Mar 25, 1:38 pm, nabrown78 nabrow...@gmail.com wrote:
 But for that you have to wait until all the images have actually
 loaded. I thought it would be faster to get the attribute. Is that
 wrong?

 On Mar 25, 11:39 am, MorningZ morni...@gmail.com wrote:

  Use

  this_img.width()

  instead

 http://docs.jquery.com/CSS/width

  On Mar 25, 11:47 am, nabrown78 nabrow...@gmail.com wrote:

   Hi All, I have the following code:

   $('#slides img').each(function(i){//calculate margins and wrap
                   var this_img = $(this);
                   var imgMargin = Math.round((550 - (this_img.attr(width) 
   + 35))/2)
   + 5;
                   this_img.wrap('div class=wrap0 style=margin-left:' + 
   imgMargin +
   'pxdiv class=wrap1div class=wrap2div class=wrap3/div/
   div/div/div');
                   $('#content').append('p'+imgMargin+'/p');
           });

   On this page:http://www.colleenkiely.com/testLayout2003-2006.htm

   In Firefox and Safari the margin is correctly set. In IE7, the margin
   is calculated as if this_img.attr(width) were 0. The html markup has
   the height and width of each img set explicitly:

   img src=http://www.colleenkiely.com/site_images/2.jpg; height=510
   width=507 alt=Dog with Egg Hat (#2) /

   I am using the latest JQuery - 1.3.2.

   Any insight into this mystery sincerely appreciated.


[jQuery] jqmodal Ajax issue

2009-03-25 Thread Tad

Hello,
I'm new to jquery and jqmodal. I have a script that runs fine except
when the URL (href) of the anchor tag is Blank or #. so what I want
to do is check for that possibility and stop the Jqmodal from acting
or put up an error message, without my page being messed up. I've
tried to use callbacks, but get an error that the hash is not defined.
I tried to use the click event of the anchor, but the Jqmodal would
load the content but only show it after clicking another anchor tag or
clicking the same one again. the goal here is to have a default pop Up
jqmodal that checks the link it is given and doesn't use it if it will
cause an error.

~~ code that works but doesn't check href of anchor~~
$(function(){
/* init pop-up/overlay */
popUp.init();
});
/* pop-up/overlay Functionality */
var popUp = {
init: function(){
var link = $(a.popup);
if(link.length = 0)
return false;
popUp.createDiv();

$('div#popup-wraper').jqm({
   trigger: $(a.popup),
   closeClass: 'close',
   toTop: true,
   ajax: '@href',
   target: $(div#popup-wraper div#popup),
   ajaxText: (loading...),
   cache: false
})
},
createDiv: function(){
var strJq = div id='popup-wraper' class='jqmWindow';
strJq +=  div id='overlay-utility';
strJq +=   a class='close' href='#'Close/a;
strJq +=  /div;
strJq +=  div id='popup';
strJq +=  /div;
strJq += /div;
$(body).append(strJq);
}

}

/* pop-up/overlay Functionality END */
~~ end code ~~


[jQuery] Re: creating search page with click for more results.

2009-03-25 Thread James

I don't see the issue, but I do see something that might affect it.
Try:

$(.vieworderdata).live(click,function() {
$(.order_logs1).show(slow);
return false;  // -- added this line
});

Since you're clicking on a a link, the return false tells the
browser not to follow-through with the actual action of clicking the
a link (which is, go to href=#).
Other than that, it looks fine. If you remove the display:none
from .order_logs1, does it display as expected?

On Mar 24, 1:58 pm, iskills i...@infiniteskills.com wrote:
 Thanks James - that helps quite a bit!

 I am now able to execute an alert, using the .live function for the
 added elements on the page.

 The issue I am now having is that the display of the order_logs
 element will not show.  Do I need to do another .live call on that?
 I am a bit confused now ;)

 div class=dlorder
         span class=orderida href=# title=1 class=vieworderdata1/
 a/span
         span class=orderdate2009-03-24/span
         span class=name123 - wiget/span
         div style=display: none class=order_logs1
                 span class=access_keyAccess Key: 3452/span
                 div class=log
                         span class=log_date2009-23-04 10:0004/span
                         span class=log_ip0.0.0.0/span
                         span class=disk_noDisk Number: 1/span
                 /div
         /div
 /div

 That is the return data from that original AJAX call again, and this
 is the new javascript:
 $(document).ready(function(){
         $(#sboid).click(function(){
                 
 $(#search_results).load(/cart/admin/files/ajax.html,{order_id:$
 ('#orderid').val(),action:digital_search});
         });
         $(.vieworderdata).live(click,function() {
                 $(.order_logs1).show(slow);
         });

 });

 So I have the .live function for the click, and if I do an alert in
 that call, it executes.  However, the .show does not in this case...

 Is it again, something in the formatting of the elements, or am I
 missing something else here

 Thanks again!

 On Mar 24, 6:39 pm, James james.gp@gmail.com wrote:

  The issue is that once you bind a click handler on existing elements,
  it will not take effect on elements added in the future. You can re-
  bind it again once you added the new content, or you can use jQuery's
  live() function in place of click() to have elements added in the
  future to also have the event attached. This is good since once you
  call it on page load, you don't have to call it 
  again.http://docs.jquery.com/Events/live

  Another possible issue with your code is your use of element IDs. You
  can only have one unique ID on one HTML page at any time. If you keep
  clicking on more, you're going to have many 'vieworderdata' IDs, and
  that's not valid. To offset this issue, use the class attribute
  instead, as you can have more than one element with the same class
  attribute on a page. Then change your click binding to use
  the .myClass instead of #myID.

  Another minor issue is that your should use double-quotes for your
  element attributes in HTML.
  Instead of:
  div id='dlorder'

  use:
  div id=dlorder

  On Mar 24, 11:08 am, iskills i...@infiniteskills.com wrote:

   OK - let me please preface this by the fact that I am now 12 hours
   into jQuery, with a pretty basic Javascript understanding, and years
   of PHP work.  I could not find the answer to my questions, mostly
   because I don't exactly know how to frame them!

   I am creating a search with expandable results.  The search part I
   have down just fine, I have a form submit button that executes a .load
   function that drops the search results to a div.  So far so good -
   this works wonders.  Now, what I am trying to accomplish and cannot,
   is for a linked item in that returned data, to then show/hide
   additional data passed through to it in a hidden div.

   So my javascript is this:
   $(document).ready(function(){
           $(#sboid).click(function(){
                   
   $(#search_results).load(ajax.html,{order_id:$('#orderid').val
   (),action:digital_search});
           });
           $(#vieworderdata).click(function() {
                   $(#order_logs).show(slow);
           });

   });

   The return from the ajax.html page would be something like:
   div id='dlorder'
           span id='orderid'a href='#' id='vieworderdata'1234/a/span
           span id='orderdate'2009-03-24/span
           span id='name'4456 - widget/span
           div style='display: none' id='order_logs'
                   span id='access_key'Access Key: absdcef/span
                   div id='log'
                           span id='log_date'2009-03-24 10:00:02/span
                           span id='log_ip'0.0.0.0/span
                           span id='disk_no'Disk Number: 1/span
                   /div
           /div
   /div

   That gets returned into the     div id='search_results'/div in the
   

[jQuery] Re: attr(href) giving full path instead of relative in IE

2009-03-25 Thread Shane Riley

Karl, I'm pretty sure I'm reading you right, but are you saying that
by all accounts JQuery should account for this and return the string-
literal value of href and not IE's absolute path? If so, it's not
working properly. I wish I could show you the live code, because it's
probably easier to visualize, but here's the process involved in these
specific anchors appearing before manipulation:
1. User visits page
2. User makes selection from a drop-down
3. Ajax call initialized sending the href attribute as the variables
using a POST request

So in this case, the anchors in the drop-down list are present on page
load and part of the initial DOM structure. That means that if JQuery
is supposed to sort this out for me, it's not. If you meant that I'd
absolutely have to use Javascript's getAttribute(), then I'll try that
and see if it works.

On Mar 25, 1:17 pm, Karl Swedberg k...@englishrules.com wrote:
 Hi Shane,

 IE has a second flag argument for getAttribute that, when set to 2,
 is supposed to get the literal value of the attribute rather than
 their special-sauce value.

 So, this.getAttribute('href', 2) *should* get the relative href.
 (note: no need to do $(this)[0] ; this works just fine)

 jQuery uses that flag internally, so .attr('href') should do the same
 thing:

 var attr = !jQuery.support.hrefNormalized  notxml 
  special
 // Some attributes require a special 
 call on IE
 ? elem.getAttribute( name, 2 )
 : elem.getAttribute( name );

 I believe that this works in every case except when the href is set
 via JavaScript. In that case, I'm not sure anything can be done.

 --Karl

 
 Karl Swedbergwww.englishrules.comwww.learningjquery.com

 On Mar 25, 2009, at 12:21 PM, Shane Riley wrote:



  Ha! I looked at your post too fast, and didn't notice that it was pure
  Javascript. Sorry. I'll try it and see.

  The way I currently have it will not work with javascript turned off
  either. I'm doing it this way only because the client is requiring the
  user to have Javascript enabled to use the site (it's a backend system
  for very specific clients). They want to add all sorts of animations
  and effects like everyone wants to do once they see JQuery animations
  in action.

  On Mar 25, 12:14 pm, Martijn Houtman martijn.hout...@gmail.com
  wrote:
  On Mar 25, 2009, at 5:04 PM, Shane Riley wrote:

  Thanks for the article link, but your proposed change isn't valid
  JQuery, is it? My exact jQuery code to read in the value looks like
  this:
  pageID = $(this).attr(href);
  Adding what you suggested to make it $(this)[0].attr(href) will
  not
  do anything apart from force the link to be followed.

  Well, no. I suggested using:

  pageID = $(this)[0].attr;

  This is plain JavaScript, rather than using jQuery's attr() function.
  As the article suggests, this works cross-browser.

  I think I'm going to have to move the contents of href to rel
  instead.

  Well, you could, but I wouldn't; this is not what the rel attribute
  is meant for. Besides, it would break the anchor when JavaScript is
  turned off.

  Regards,
  --
  Martijn.


[jQuery] Re: element type of matched id

2009-03-25 Thread James

$(#foo)[0].nodeName;

On Mar 25, 8:15 am, Brad nrmlcrpt...@gmail.com wrote:
 I'm working on a page that dynamically changes many form elements.
 Because of the way that different browsers style disabled or readonly
 text inputs, I'm swapping the input with a span that displays more
 consistently. I don't need to submit those fields. However, when I do
 this the affected element's ID does not change. There are also some
 other cases where a control may change from a free text input to a
 select menu and vice versa, but again with the same ID.

 If there a way for me to figure out what the type of element for a
 matched ID? For example if

     $(#foo)

 matches

     input id=foo ...

 I'd like to know it is an input, but if

     $(#foo)

 matches

     span id=foo ...

 I'd like to know it is a span?


[jQuery] element type of matched id

2009-03-25 Thread Brad

I'm working on a page that dynamically changes many form elements.
Because of the way that different browsers style disabled or readonly
text inputs, I'm swapping the input with a span that displays more
consistently. I don't need to submit those fields. However, when I do
this the affected element's ID does not change. There are also some
other cases where a control may change from a free text input to a
select menu and vice versa, but again with the same ID.

If there a way for me to figure out what the type of element for a
matched ID? For example if

$(#foo)

matches

input id=foo ...

I'd like to know it is an input, but if

$(#foo)

matches

span id=foo ...

I'd like to know it is a span?


[jQuery] Re: element type of matched id

2009-03-25 Thread Brad

Thanks for this too. I was looking for the documentation for .is the
other day and couldn't find it.

On Mar 25, 12:26 pm, jerone jeron...@gmail.com wrote:
 You can do:
   $(input#foo)
   $(span#foo)

 or you can use the is function:http://docs.jquery.com/Traversing/is#expr
   if($(#foo).is(span)){
     // code
   }else if($(#foo).is(input)){
     // code
   }

 On 25 mrt, 19:15, Brad nrmlcrpt...@gmail.com wrote:

  I'm working on a page that dynamically changes many form elements.
  Because of the way that different browsers style disabled or readonly
  text inputs, I'm swapping the input with a span that displays more
  consistently. I don't need to submit those fields. However, when I do
  this the affected element's ID does not change. There are also some
  other cases where a control may change from a free text input to a
  select menu and vice versa, but again with the same ID.

  If there a way for me to figure out what the type of element for a
  matched ID? For example if

      $(#foo)

  matches

      input id=foo ...

  I'd like to know it is an input, but if

      $(#foo)

  matches

      span id=foo ...

  I'd like to know it is a span?


[jQuery] Re: IE7 returning 0 for attr(width) on an img with width set

2009-03-25 Thread nabrown78

But for that you have to wait until all the images have actually
loaded. I thought it would be faster to get the attribute. Is that
wrong?

On Mar 25, 11:39 am, MorningZ morni...@gmail.com wrote:
 Use

 this_img.width()

 instead

 http://docs.jquery.com/CSS/width

 On Mar 25, 11:47 am, nabrown78 nabrow...@gmail.com wrote:

  Hi All, I have the following code:

  $('#slides img').each(function(i){//calculate margins and wrap
                  var this_img = $(this);
                  var imgMargin = Math.round((550 - (this_img.attr(width) + 
  35))/2)
  + 5;
                  this_img.wrap('div class=wrap0 style=margin-left:' + 
  imgMargin +
  'pxdiv class=wrap1div class=wrap2div class=wrap3/div/
  div/div/div');
                  $('#content').append('p'+imgMargin+'/p');
          });

  On this page:http://www.colleenkiely.com/testLayout2003-2006.htm

  In Firefox and Safari the margin is correctly set. In IE7, the margin
  is calculated as if this_img.attr(width) were 0. The html markup has
  the height and width of each img set explicitly:

  img src=http://www.colleenkiely.com/site_images/2.jpg; height=510
  width=507 alt=Dog with Egg Hat (#2) /

  I am using the latest JQuery - 1.3.2.

  Any insight into this mystery sincerely appreciated.


[jQuery] Traversing nested lists not working in IE

2009-03-25 Thread Andrew

HTML:
ul
li/li
li/li
ul
li/li
/ul
li/li
/ul

JS:
$(ul li).click(function(){
$(this).next().doSomething();
});

When I click on any li that has an li after it, that next li will
'doSomething'.
But, when I click on the li that has a ul after, only in IE, the ul is
ignored and it will 'doSomething' to the li after the ignored ul. FF
and Safari both act on the ul.
Is there anyway to get IE to recognize the ul as the 'next()' of the
li before it?


[jQuery] Re: element type of matched id

2009-03-25 Thread Brad

Exactly what I need. Thanks!

On Mar 25, 12:25 pm, James james.gp@gmail.com wrote:
 $(#foo)[0].nodeName;



[jQuery] Re: element type of matched id

2009-03-25 Thread jerone

You can do:
  $(input#foo)
  $(span#foo)

or you can use the is function: http://docs.jquery.com/Traversing/is#expr
  if($(#foo).is(span)){
// code
  }else if($(#foo).is(input)){
// code
  }

On 25 mrt, 19:15, Brad nrmlcrpt...@gmail.com wrote:
 I'm working on a page that dynamically changes many form elements.
 Because of the way that different browsers style disabled or readonly
 text inputs, I'm swapping the input with a span that displays more
 consistently. I don't need to submit those fields. However, when I do
 this the affected element's ID does not change. There are also some
 other cases where a control may change from a free text input to a
 select menu and vice versa, but again with the same ID.

 If there a way for me to figure out what the type of element for a
 matched ID? For example if

     $(#foo)

 matches

     input id=foo ...

 I'd like to know it is an input, but if

     $(#foo)

 matches

     span id=foo ...

 I'd like to know it is a span?


[jQuery] Re: jqmodal Ajax issue

2009-03-25 Thread Alexandre Plennevaux
1/ i would make sure the div exist before initalising the jqModal, so  add
the jqm initialisation to your createDiv function or through a callback
executed when the createDiv is done.2/ for your specific question: your
check is incorrect. The good use would be to use jqmodal onShow() callback
and check at that moment whether the link is valid or not.

onshow:function(hash){
if (hash.t.attr('href') ==='#' || hash.t.attr('href') ===''){
return false;
}
// otherwise, launch the popup
hash.w.css('opacity',0.88).show();

}

from the doc:


  Each callback is passed the jqModal hash for a window. Relevant
hash properties are;

---
w: (jQuery object) The window element. e.g. '#example' in the sample 
above
c: (object) The config object (holds passed+default parameters)
o: (jQuery object) The overlay
t: (DOM object) The triggering element

  NOTE; If you supply a onHide callback, you MUST execute hash.o.remove(); to
remove the overlay. You should also hide the window via hash.w.hide();, or
with a special effect.

  NOTE; If you supply a onShow callback, you should make the dialog visible
via hash.w.show();, or with a special effect.

  NOTE; onLoad callbacks are ONLY executed if the ajax parameter was passed.
onLoad is called after the ajax response. As with $.load(), the this
scope is a reference to the ajax target as a DOM element.





On Wed, Mar 25, 2009 at 6:13 PM, Tad tad.ni...@gmail.com wrote:


 Hello,
 I'm new to jquery and jqmodal. I have a script that runs fine except
 when the URL (href) of the anchor tag is Blank or #. so what I want
 to do is check for that possibility and stop the Jqmodal from acting
 or put up an error message, without my page being messed up. I've
 tried to use callbacks, but get an error that the hash is not defined.
 I tried to use the click event of the anchor, but the Jqmodal would
 load the content but only show it after clicking another anchor tag or
 clicking the same one again. the goal here is to have a default pop Up
 jqmodal that checks the link it is given and doesn't use it if it will
 cause an error.

 ~~ code that works but doesn't check href of anchor~~
 $(function(){
 /* init pop-up/overlay */
popUp.init();
 });
 /* pop-up/overlay Functionality */
 var popUp = {
init: function(){
var link = $(a.popup);
if(link.length = 0)
return false;
popUp.createDiv();

$('div#popup-wraper').jqm({
   trigger: $(a.popup),
   closeClass: 'close',
   toTop: true,
   ajax: '@href',
   target: $(div#popup-wraper div#popup),
   ajaxText: (loading...),
   cache: false
})
},
createDiv: function(){
var strJq = div id='popup-wraper' class='jqmWindow';
strJq +=  div id='overlay-utility';
strJq +=   a class='close' href='#'Close/a;
strJq +=  /div;
strJq +=  div id='popup';
strJq +=  /div;
strJq += /div;
$(body).append(strJq);
}

 }

 /* pop-up/overlay Functionality END */
 ~~ end code ~~



[jQuery] s3Slider IE opacity question

2009-03-25 Thread Matt

Hi All,

I'm trying to make use of the s3Slider plugin. It works great for me
in FF and Safari. However in IE7 and 8, the opacity i set shows up
correctly for the initial image/slide, but each slide after that is at
100% opacity over the image. Does anyone have any idea what would
cause this to happen?

I'm using what I believe to be the latest version of the plugin and
css on GitHub.

Thanks,

Matt


[jQuery] Re: attr(href) giving full path instead of relative in IE

2009-03-25 Thread Shane Riley

After replacing $(this).attr(href) with this.getAttribute(href, 2)
I get the same result. If I output the attribute, IE still shows the
absolute path.

On Mar 25, 2:21 pm, Shane Riley shanerileydoti...@gmail.com wrote:
 Karl, I'm pretty sure I'm reading you right, but are you saying that
 by all accounts JQuery should account for this and return the string-
 literal value of href and not IE's absolute path? If so, it's not
 working properly. I wish I could show you the live code, because it's
 probably easier to visualize, but here's the process involved in these
 specific anchors appearing before manipulation:
 1. User visits page
 2. User makes selection from a drop-down
 3. Ajax call initialized sending the href attribute as the variables
 using a POST request

 So in this case, the anchors in the drop-down list are present on page
 load and part of the initial DOM structure. That means that if JQuery
 is supposed to sort this out for me, it's not. If you meant that I'd
 absolutely have to use Javascript's getAttribute(), then I'll try that
 and see if it works.

 On Mar 25, 1:17 pm, Karl Swedberg k...@englishrules.com wrote:

  Hi Shane,

  IE has a second flag argument for getAttribute that, when set to 2,
  is supposed to get the literal value of the attribute rather than
  their special-sauce value.

  So, this.getAttribute('href', 2) *should* get the relative href.
  (note: no need to do $(this)[0] ; this works just fine)

  jQuery uses that flag internally, so .attr('href') should do the same
  thing:

  var attr = !jQuery.support.hrefNormalized  notxml 
   special
  // Some attributes require a 
  special call on IE
  ? elem.getAttribute( name, 2 )
  : elem.getAttribute( name );

  I believe that this works in every case except when the href is set
  via JavaScript. In that case, I'm not sure anything can be done.

  --Karl

  
  Karl Swedbergwww.englishrules.comwww.learningjquery.com

  On Mar 25, 2009, at 12:21 PM, Shane Riley wrote:

   Ha! I looked at your post too fast, and didn't notice that it was pure
   Javascript. Sorry. I'll try it and see.

   The way I currently have it will not work with javascript turned off
   either. I'm doing it this way only because the client is requiring the
   user to have Javascript enabled to use the site (it's a backend system
   for very specific clients). They want to add all sorts of animations
   and effects like everyone wants to do once they see JQuery animations
   in action.

   On Mar 25, 12:14 pm, Martijn Houtman martijn.hout...@gmail.com
   wrote:
   On Mar 25, 2009, at 5:04 PM, Shane Riley wrote:

   Thanks for the article link, but your proposed change isn't valid
   JQuery, is it? My exact jQuery code to read in the value looks like
   this:
   pageID = $(this).attr(href);
   Adding what you suggested to make it $(this)[0].attr(href) will
   not
   do anything apart from force the link to be followed.

   Well, no. I suggested using:

   pageID = $(this)[0].attr;

   This is plain JavaScript, rather than using jQuery's attr() function.
   As the article suggests, this works cross-browser.

   I think I'm going to have to move the contents of href to rel
   instead.

   Well, you could, but I wouldn't; this is not what the rel attribute
   is meant for. Besides, it would break the anchor when JavaScript is
   turned off.

   Regards,
   --
   Martijn.


[jQuery] Re: Traversing nested lists not working in IE

2009-03-25 Thread Richard D. Worth
That html isn't valid. The nested ul element can't be a child of a ul. It
needs to be a child of an li, like so

ul
  li/li
  li
ul
  li/li
/ul
  /li
  li/li
/ul

- Richard

On Wed, Mar 25, 2009 at 1:50 PM, Andrew andrewgtibbe...@gmail.com wrote:


 HTML:
 ul
li/li
li/li
ul
li/li
/ul
li/li
 /ul

 JS:
 $(ul li).click(function(){
$(this).next().doSomething();
 });

 When I click on any li that has an li after it, that next li will
 'doSomething'.
 But, when I click on the li that has a ul after, only in IE, the ul is
 ignored and it will 'doSomething' to the li after the ignored ul. FF
 and Safari both act on the ul.
 Is there anyway to get IE to recognize the ul as the 'next()' of the
 li before it?


[jQuery] Re: attr(href) giving full path instead of relative in IE

2009-03-25 Thread Karl Swedberg

Hi Shane,

Yes, I believe you're reading me right. Strange, though. I'm not able  
to reproduce the problem you're having. Take a look here:


http://test.learningjquery.com/href.html

In IE 7 for #1 and #2 $(this).attr('href') is reporting the actual  
text string of the href attribute while this.href is reporting the  
fully qualified URL. For #3, in which I injected the link with  
javascript, they're both reporting the fully qualified URL.


Which version of IE are you testing in?

--Karl


Karl Swedberg
www.englishrules.com
www.learningjquery.com




On Mar 25, 2009, at 2:21 PM, Shane Riley wrote:



Karl, I'm pretty sure I'm reading you right, but are you saying that
by all accounts JQuery should account for this and return the string-
literal value of href and not IE's absolute path? If so, it's not
working properly. I wish I could show you the live code, because it's
probably easier to visualize, but here's the process involved in these
specific anchors appearing before manipulation:
1. User visits page
2. User makes selection from a drop-down
3. Ajax call initialized sending the href attribute as the variables
using a POST request

So in this case, the anchors in the drop-down list are present on page
load and part of the initial DOM structure. That means that if JQuery
is supposed to sort this out for me, it's not. If you meant that I'd
absolutely have to use Javascript's getAttribute(), then I'll try that
and see if it works.

On Mar 25, 1:17 pm, Karl Swedberg k...@englishrules.com wrote:

Hi Shane,

IE has a second flag argument for getAttribute that, when set to 2,
is supposed to get the literal value of the attribute rather than
their special-sauce value.

So, this.getAttribute('href', 2) *should* get the relative href.
(note: no need to do $(this)[0] ; this works just fine)

jQuery uses that flag internally, so .attr('href') should do the same
thing:

   var attr = !jQuery.support.hrefNormalized   
notxml  special
   // Some attributes require a  
special call on IE

   ? elem.getAttribute( name, 2 )
   : elem.getAttribute( name );

I believe that this works in every case except when the href is set
via JavaScript. In that case, I'm not sure anything can be done.

--Karl


Karl Swedbergwww.englishrules.comwww.learningjquery.com

On Mar 25, 2009, at 12:21 PM, Shane Riley wrote:



Ha! I looked at your post too fast, and didn't notice that it was  
pure

Javascript. Sorry. I'll try it and see.



The way I currently have it will not work with javascript turned off
either. I'm doing it this way only because the client is requiring  
the
user to have Javascript enabled to use the site (it's a backend  
system

for very specific clients). They want to add all sorts of animations
and effects like everyone wants to do once they see JQuery  
animations

in action.



On Mar 25, 12:14 pm, Martijn Houtman martijn.hout...@gmail.com
wrote:

On Mar 25, 2009, at 5:04 PM, Shane Riley wrote:



Thanks for the article link, but your proposed change isn't valid
JQuery, is it? My exact jQuery code to read in the value looks  
like

this:
pageID = $(this).attr(href);
Adding what you suggested to make it $(this)[0].attr(href) will
not
do anything apart from force the link to be followed.



Well, no. I suggested using:



pageID = $(this)[0].attr;


This is plain JavaScript, rather than using jQuery's attr()  
function.

As the article suggests, this works cross-browser.



I think I'm going to have to move the contents of href to rel
instead.



Well, you could, but I wouldn't; this is not what the rel attribute
is meant for. Besides, it would break the anchor when JavaScript is
turned off.



Regards,
--
Martijn.




[jQuery] Re: Traversing nested lists not working in IE

2009-03-25 Thread Andrew

Stupid standards. :)
That's what I suspected. Thanks Richard.


On Mar 25, 2:08 pm, Richard D. Worth rdwo...@gmail.com wrote:
 That html isn't valid. The nested ul element can't be a child of a ul. It
 needs to be a child of an li, like so

 ul
   li/li
   li
     ul
       li/li
     /ul
   /li
   li/li
 /ul

 - Richard

 On Wed, Mar 25, 2009 at 1:50 PM, Andrew andrewgtibbe...@gmail.com wrote:

  HTML:
  ul
     li/li
     li/li
     ul
         li/li
     /ul
     li/li
  /ul

  JS:
  $(ul li).click(function(){
     $(this).next().doSomething();
  });

  When I click on any li that has an li after it, that next li will
  'doSomething'.
  But, when I click on the li that has a ul after, only in IE, the ul is
  ignored and it will 'doSomething' to the li after the ignored ul. FF
  and Safari both act on the ul.
  Is there anyway to get IE to recognize the ul as the 'next()' of the
  li before it?


[jQuery] Re: attr(href) giving full path instead of relative in IE

2009-03-25 Thread Shane Riley

Alright, so your example shows the actual strings for all three values
in Safari, and in IE7(Vista) it shows the absolute path for #3. After
looking back at my code, I'm actually loading in the links via Ajax
when the page is loaded, so they're not in the original document. So
I'm guessing that means having to do string manipulation since there's
no way to grab the actual href string in IE in this case.

Thanks for putting up an example.

On Mar 25, 3:11 pm, Karl Swedberg k...@englishrules.com wrote:
 Hi Shane,

 Yes, I believe you're reading me right. Strange, though. I'm not able  
 to reproduce the problem you're having. Take a look here:

 http://test.learningjquery.com/href.html

 In IE 7 for #1 and #2 $(this).attr('href') is reporting the actual  
 text string of the href attribute while this.href is reporting the  
 fully qualified URL. For #3, in which I injected the link with  
 javascript, they're both reporting the fully qualified URL.

 Which version of IE are you testing in?

 --Karl

 
 Karl Swedbergwww.englishrules.comwww.learningjquery.com

 On Mar 25, 2009, at 2:21 PM, Shane Riley wrote:



  Karl, I'm pretty sure I'm reading you right, but are you saying that
  by all accounts JQuery should account for this and return the string-
  literal value of href and not IE's absolute path? If so, it's not
  working properly. I wish I could show you the live code, because it's
  probably easier to visualize, but here's the process involved in these
  specific anchors appearing before manipulation:
  1. User visits page
  2. User makes selection from a drop-down
  3. Ajax call initialized sending the href attribute as the variables
  using a POST request

  So in this case, the anchors in the drop-down list are present on page
  load and part of the initial DOM structure. That means that if JQuery
  is supposed to sort this out for me, it's not. If you meant that I'd
  absolutely have to use Javascript's getAttribute(), then I'll try that
  and see if it works.

  On Mar 25, 1:17 pm, Karl Swedberg k...@englishrules.com wrote:
  Hi Shane,

  IE has a second flag argument for getAttribute that, when set to 2,
  is supposed to get the literal value of the attribute rather than
  their special-sauce value.

  So, this.getAttribute('href', 2) *should* get the relative href.
  (note: no need to do $(this)[0] ; this works just fine)

  jQuery uses that flag internally, so .attr('href') should do the same
  thing:

                         var attr = !jQuery.support.hrefNormalized   
  notxml  special
                                         // Some attributes require a  
  special call on IE
                                         ? elem.getAttribute( name, 2 )
                                         : elem.getAttribute( name );

  I believe that this works in every case except when the href is set
  via JavaScript. In that case, I'm not sure anything can be done.

  --Karl

  
  Karl Swedbergwww.englishrules.comwww.learningjquery.com

  On Mar 25, 2009, at 12:21 PM, Shane Riley wrote:

  Ha! I looked at your post too fast, and didn't notice that it was  
  pure
  Javascript. Sorry. I'll try it and see.

  The way I currently have it will not work with javascript turned off
  either. I'm doing it this way only because the client is requiring  
  the
  user to have Javascript enabled to use the site (it's a backend  
  system
  for very specific clients). They want to add all sorts of animations
  and effects like everyone wants to do once they see JQuery  
  animations
  in action.

  On Mar 25, 12:14 pm, Martijn Houtman martijn.hout...@gmail.com
  wrote:
  On Mar 25, 2009, at 5:04 PM, Shane Riley wrote:

  Thanks for the article link, but your proposed change isn't valid
  JQuery, is it? My exact jQuery code to read in the value looks  
  like
  this:
  pageID = $(this).attr(href);
  Adding what you suggested to make it $(this)[0].attr(href) will
  not
  do anything apart from force the link to be followed.

  Well, no. I suggested using:

  pageID = $(this)[0].attr;

  This is plain JavaScript, rather than using jQuery's attr()  
  function.
  As the article suggests, this works cross-browser.

  I think I'm going to have to move the contents of href to rel
  instead.

  Well, you could, but I wouldn't; this is not what the rel attribute
  is meant for. Besides, it would break the anchor when JavaScript is
  turned off.

  Regards,
  --
  Martijn.


[jQuery] Re: looping through json and adding dom elements (options)

2009-03-25 Thread Eric Garside

Ice, I just recently released a plugin that might suit your needs.
It's basically a way to transmit HTML as JSON for this exact kind of
thing.

Check out: code.google.com/p/hsjn

Taking the case you gave, if you change the JSON your returning to:

[['option', {value: 1}, 'Physics'],['option', {value: 2}, 'Chemistry'],
['option', {value: 3}, 'Biology']]

You can do the following in your ajax success function:

success: function(data){
   var el = $('#idOfYourDropdown').children().remove();
   $.each(data, function(){
  el.hsjn(this);
   });
}

iceangel89 wrote:
 i am new to jquery and what i intend to do now is to load json from
 server and then based on the json, remove all options from a drop down
 and populate it with new items from the json. something like a
 cascading drop down.

 i dunno if the json outputted is correct? do i need something like
 department: ['xxx', 'yyy', 'zzz']

 [
 {Value: 1, Item: Physics},
 {Value: 2, Item: Chemistry},
 {Value: 3, Item: Biology}
 ]

 then i want to remove all option from a drop down then populate it
 with something like

 option value=1Physics/option
 option value=2Chemistry/option
 option value=3Biology/option

 if possible, it will be good if i can have a default null option eg
 Please select an option that does not do anything if the user
 selects it or shows at the start and disappears once user selects it?
 whats the best way of having this default value? i think its very
 common.


[jQuery] Detect when all ajax queries launched by for have finished

2009-03-25 Thread Jsbeginner


Hello,

I've got a script that takes all the elements of a list and on click of 
a button it runs an ajax query for each item. It all works fine however 
I would like to have a searching message during the search and a 
finished message after the search has finished, but I can't think how 
to detect when the for cycle has finished and all ajax queiries ...


Here's the code :

function checkall(){
$('#myform').submit(function() {
$(#status).html(Searching);
$(#mylistoption).each(function(i){
lst[i] = $(this).val();  
 });

for ( var e in lst) {
  checkajax(lst[e]);
}
});
$(#status).html(Finished);
}

function checkajax(e){
$.ajax({
url : /scripts/checkdata.php,
type : POST,
data : number=+e,
dataType : json,
cache: false,
error : function (xhr, desc, exception) { 
$(#status).html(Error);},

success : function (data) {
 
$(#mytable).append(trtd+data.id+/tdtd+data.name+/td/tr)

}
}
});
}


As you can guess the following line :

$(#status).html(Finished);

makes the status be finished before the ajax answers have been recieved...

I would like to keep the ajax being asynchronous but detect when all the 
queries sent by the for have finished and not when they have just been 
sent ...


Do you have any suggestions how I could achieve this ?

Thankyou.



[jQuery] Re: attr(href) giving full path instead of relative in IE

2009-03-25 Thread Karl Swedberg
Well, the string manipulation is pretty minimal. Just use  
this.pathname --  or some combination of this.pathname, this.hash, and  
this.search if necessary.


The one problem with this.pathname is that IE and Opera omit the  
initial slash while FF and Safari include it. But that's not hard to  
normalize with a simple regular expression. For example:


var noslash = this.pathname.replace(/^\//,'');

Or you could do this:

var noslash = this.pathname.indexOf('/') === 0 ?  
this.pathname.slice(1) : this.pathname



--Karl


Karl Swedberg
www.englishrules.com
www.learningjquery.com




On Mar 25, 2009, at 3:20 PM, Shane Riley wrote:



Alright, so your example shows the actual strings for all three values
in Safari, and in IE7(Vista) it shows the absolute path for #3. After
looking back at my code, I'm actually loading in the links via Ajax
when the page is loaded, so they're not in the original document. So
I'm guessing that means having to do string manipulation since there's
no way to grab the actual href string in IE in this case.

Thanks for putting up an example.

On Mar 25, 3:11 pm, Karl Swedberg k...@englishrules.com wrote:

Hi Shane,

Yes, I believe you're reading me right. Strange, though. I'm not able
to reproduce the problem you're having. Take a look here:

http://test.learningjquery.com/href.html

In IE 7 for #1 and #2 $(this).attr('href') is reporting the actual
text string of the href attribute while this.href is reporting the
fully qualified URL. For #3, in which I injected the link with
javascript, they're both reporting the fully qualified URL.

Which version of IE are you testing in?

--Karl


Karl Swedbergwww.englishrules.comwww.learningjquery.com

On Mar 25, 2009, at 2:21 PM, Shane Riley wrote:




Karl, I'm pretty sure I'm reading you right, but are you saying that
by all accounts JQuery should account for this and return the  
string-

literal value of href and not IE's absolute path? If so, it's not
working properly. I wish I could show you the live code, because  
it's
probably easier to visualize, but here's the process involved in  
these

specific anchors appearing before manipulation:
1. User visits page
2. User makes selection from a drop-down
3. Ajax call initialized sending the href attribute as the variables
using a POST request


So in this case, the anchors in the drop-down list are present on  
page
load and part of the initial DOM structure. That means that if  
JQuery

is supposed to sort this out for me, it's not. If you meant that I'd
absolutely have to use Javascript's getAttribute(), then I'll try  
that

and see if it works.



On Mar 25, 1:17 pm, Karl Swedberg k...@englishrules.com wrote:

Hi Shane,


IE has a second flag argument for getAttribute that, when set  
to 2,

is supposed to get the literal value of the attribute rather than
their special-sauce value.



So, this.getAttribute('href', 2) *should* get the relative href.
(note: no need to do $(this)[0] ; this works just fine)


jQuery uses that flag internally, so .attr('href') should do the  
same

thing:



   var attr = !jQuery.support.hrefNormalized 
notxml  special
   // Some attributes require a
special call on IE
   ? elem.getAttribute( name,  
2 )

   : elem.getAttribute( name );



I believe that this works in every case except when the href is set
via JavaScript. In that case, I'm not sure anything can be done.



--Karl




Karl Swedbergwww.englishrules.comwww.learningjquery.com



On Mar 25, 2009, at 12:21 PM, Shane Riley wrote:



Ha! I looked at your post too fast, and didn't notice that it was
pure
Javascript. Sorry. I'll try it and see.


The way I currently have it will not work with javascript turned  
off

either. I'm doing it this way only because the client is requiring
the
user to have Javascript enabled to use the site (it's a backend
system
for very specific clients). They want to add all sorts of  
animations

and effects like everyone wants to do once they see JQuery
animations
in action.



On Mar 25, 12:14 pm, Martijn Houtman martijn.hout...@gmail.com
wrote:

On Mar 25, 2009, at 5:04 PM, Shane Riley wrote:


Thanks for the article link, but your proposed change isn't  
valid

JQuery, is it? My exact jQuery code to read in the value looks
like
this:
pageID = $(this).attr(href);
Adding what you suggested to make it $(this)[0].attr(href)  
will

not
do anything apart from force the link to be followed.



Well, no. I suggested using:



pageID = $(this)[0].attr;



This is plain JavaScript, rather than using jQuery's attr()
function.
As the article suggests, this works cross-browser.



I think I'm going to have to move the contents of href to rel
instead.


Well, you could, but I wouldn't; this is not what the rel  
attribute
is meant for. Besides, it would break the anchor when  
JavaScript is

turned off.




[jQuery] Re: Detect when all ajax queries launched by for have finished

2009-03-25 Thread MorningZ

This is totally off the cuff and untested, but

http://paste.pocoo.org/show/109610/

should work


On Mar 25, 3:20 pm, Jsbeginner jsbegin...@monarobase.net wrote:
 Hello,

 I've got a script that takes all the elements of a list and on click of
 a button it runs an ajax query for each item. It all works fine however
 I would like to have a searching message during the search and a
 finished message after the search has finished, but I can't think how
 to detect when the for cycle has finished and all ajax queiries ...

 Here's the code :



  function checkall(){
  $('#myform').submit(function() {
  $(#status).html(Searching);
  $(#mylistoption).each(function(i){
              lst[i] = $(this).val();                      
   });
  for ( var e in lst) {
        checkajax(lst[e]);
  }
  });
  $(#status).html(Finished);
  }

  function checkajax(e){
  $.ajax({
              url : /scripts/checkdata.php,
              type : POST,
              data : number=+e,
              dataType : json,
              cache: false,
              error : function (xhr, desc, exception) {
  $(#status).html(Error);},
              success : function (data) {

  $(#mytable).append(trtd+data.id+/tdtd+data.name+/td/tr)
                  }
              }
          });
  }

 As you can guess the following line : $(#status).html(Finished);

 makes the status be finished before the ajax answers have been recieved...

 I would like to keep the ajax being asynchronous but detect when all the
 queries sent by the for have finished and not when they have just been
 sent ...

 Do you have any suggestions how I could achieve this ?

 Thankyou.


[jQuery] Re: attr(href) giving full path instead of relative in IE

2009-03-25 Thread Shane Riley

Right, it's not hard, it was just unexpected is all. I guess I've
gotten used to JQuery working the same in all browsers.

I've got it working now with some old-fashioned Javascript. Thanks!

On Mar 25, 3:20 pm, Shane Riley shanerileydoti...@gmail.com wrote:
 Alright, so your example shows the actual strings for all three values
 in Safari, and in IE7(Vista) it shows the absolute path for #3. After
 looking back at my code, I'm actually loading in the links via Ajax
 when the page is loaded, so they're not in the original document. So
 I'm guessing that means having to do string manipulation since there's
 no way to grab the actual href string in IE in this case.

 Thanks for putting up an example.

 On Mar 25, 3:11 pm, Karl Swedberg k...@englishrules.com wrote:

  Hi Shane,

  Yes, I believe you're reading me right. Strange, though. I'm not able  
  to reproduce the problem you're having. Take a look here:

 http://test.learningjquery.com/href.html

  In IE 7 for #1 and #2 $(this).attr('href') is reporting the actual  
  text string of the href attribute while this.href is reporting the  
  fully qualified URL. For #3, in which I injected the link with  
  javascript, they're both reporting the fully qualified URL.

  Which version of IE are you testing in?

  --Karl

  
  Karl Swedbergwww.englishrules.comwww.learningjquery.com

  On Mar 25, 2009, at 2:21 PM, Shane Riley wrote:

   Karl, I'm pretty sure I'm reading you right, but are you saying that
   by all accounts JQuery should account for this and return the string-
   literal value of href and not IE's absolute path? If so, it's not
   working properly. I wish I could show you the live code, because it's
   probably easier to visualize, but here's the process involved in these
   specific anchors appearing before manipulation:
   1. User visits page
   2. User makes selection from a drop-down
   3. Ajax call initialized sending the href attribute as the variables
   using a POST request

   So in this case, the anchors in the drop-down list are present on page
   load and part of the initial DOM structure. That means that if JQuery
   is supposed to sort this out for me, it's not. If you meant that I'd
   absolutely have to use Javascript's getAttribute(), then I'll try that
   and see if it works.

   On Mar 25, 1:17 pm, Karl Swedberg k...@englishrules.com wrote:
   Hi Shane,

   IE has a second flag argument for getAttribute that, when set to 2,
   is supposed to get the literal value of the attribute rather than
   their special-sauce value.

   So, this.getAttribute('href', 2) *should* get the relative href.
   (note: no need to do $(this)[0] ; this works just fine)

   jQuery uses that flag internally, so .attr('href') should do the same
   thing:

                          var attr = !jQuery.support.hrefNormalized   
   notxml  special
                                          // Some attributes require a  
   special call on IE
                                          ? elem.getAttribute( name, 2 )
                                          : elem.getAttribute( name );

   I believe that this works in every case except when the href is set
   via JavaScript. In that case, I'm not sure anything can be done.

   --Karl

   
   Karl Swedbergwww.englishrules.comwww.learningjquery.com

   On Mar 25, 2009, at 12:21 PM, Shane Riley wrote:

   Ha! I looked at your post too fast, and didn't notice that it was  
   pure
   Javascript. Sorry. I'll try it and see.

   The way I currently have it will not work with javascript turned off
   either. I'm doing it this way only because the client is requiring  
   the
   user to have Javascript enabled to use the site (it's a backend  
   system
   for very specific clients). They want to add all sorts of animations
   and effects like everyone wants to do once they see JQuery  
   animations
   in action.

   On Mar 25, 12:14 pm, Martijn Houtman martijn.hout...@gmail.com
   wrote:
   On Mar 25, 2009, at 5:04 PM, Shane Riley wrote:

   Thanks for the article link, but your proposed change isn't valid
   JQuery, is it? My exact jQuery code to read in the value looks  
   like
   this:
   pageID = $(this).attr(href);
   Adding what you suggested to make it $(this)[0].attr(href) will
   not
   do anything apart from force the link to be followed.

   Well, no. I suggested using:

   pageID = $(this)[0].attr;

   This is plain JavaScript, rather than using jQuery's attr()  
   function.
   As the article suggests, this works cross-browser.

   I think I'm going to have to move the contents of href to rel
   instead.

   Well, you could, but I wouldn't; this is not what the rel attribute
   is meant for. Besides, it would break the anchor when JavaScript is
   turned off.

   Regards,
   --
   Martijn.


[jQuery] Re: simplemodal help - dynamic load of modal content breaks close button

2009-03-25 Thread Eric Martin

If you get the data and then use it in the dialog, it will bind the
simplemodal-close class. Otherwise, you have to do it manually in the
onShow callback.

The following will auto-bind:

$('#mylink').click(function (e) {
e.preventDefault();
// load the contact form using ajax
$.get(data/test.html, function(data){
// create a modal dialog with the data
$.modal(data); // contains a button with simplemodal-close class
});
});

If you are opening the dialog and then adding the content, you'll need
to do something like:

$.modal(data, {onShow:  function (dialog) {
  $(.simplemodal-close, dialog.data).click(function (e) {
e.preventDefault();
$.modal.close();
  });
}});

Hope that helps.

-Eric


On Mar 25, 8:49 am, dbonneville doug.bonnevi...@gmail.com wrote:
 I have an include that contains all the HTML for the modal dialogue
 content. In the HTML, I also have a close button with the class
 simplemodal-close attached to it, which triggers the close function.
 That works great.

 However, I decided to load the snippet via jquery.get. It loads in
 just fine. But now, the close button with the simplemodal-close
 class on it will now not trigger the event.

 Is this because the button with the class on it was loaded AFTER the
 script was loaded? How can I make the button work?

 Nothing in the HTML include or HTML snipped loaded through get are
 any different. When I compare pages in Firebug, the include version
 and the get version are identical in all respects.

 What do I need to do to the button AFTER its loaded via jquery.get to
 make it aware that it has the class on it?


  1   2   >