[jQuery] Re: Drag and Drop in Tabs

2009-08-13 Thread Klaus Hartl

On 13 Aug., 07:30, Applecore i...@applecorestudios.com wrote:
 The jquery.tabs.js file uses the jQuery.load function to load content
 from a file. The problem is that this function will remove all scripts
 from the file because it can't handle them.

 The only function that will allow this is the jQuery.ajax function you
 can see the part that would allow this here...

 Check outhttp://docs.jquery.com/Ajax/jQuery.ajax#options
 Scroll down to dataType and look at the html option.

 So using the current tabs that jQuery provides there isn't a way to
 pass the scripts with the file.

That's not true. It works fine.
http://stilbuero.de/jquery/test/remote_tabs_with_scripts.html

The problem is that if you load HTML into a document, the browser will
ignore anything that's in a head, e.g. the head itself because a page
can't have two head elements.

--Klaus



[jQuery] Re: jCarousell and tabs problem

2009-08-01 Thread Klaus Hartl

Please see:
http://docs.jquery.com/UI/Tabs#...my_slider.2C_Google_Map.2C_sIFR_etc._not_work_when_placed_in_a_hidden_.28inactive.29_tab.3F



On 30 Jul., 20:01, vvaz vfp...@gmail.com wrote:
 Hello all.

 I have a problem with the jCarousel Plugin when i try to display a
 second carousel inside one tab.

 Ok, the first one displays the right way. When i click the second tab,
 the second carousel is displayed but with a width of 60px (that i
 don't know how they got there).

 My html is this:

 head Section:

         !-- Import jQuery and plugins --
         script src=lib/jquery-1.3.2.js type=text/javascript/script
         script type=text/javascript src=lib/jcarousel/lib/
 jquery.jcarousel.pack.js/script
         link rel=stylesheet type=text/css href=lib/jcarousel/lib/
 jquery.jcarousel.css /
         link rel=stylesheet type=text/css href=lib/jcarousel/skins/
 tango/skin.css /
         link rel=stylesheet type=text/css href=lib/jcarousel/skins/ie7/
 skin.css /
         script type=text/javascript src=lib/tabs/general.js //script
         link rel=stylesheet href=lib/tabs/estilos.css type=text/css
 media=screen charset=utf-8 /
         /script
 script type=text/javascript

 jQuery(document).ready(function() {
         jQuery('.first-and-second-carousel').jcarousel();
         jQuery('#view2-carousel').jcarousel({
         });});

 /script

 and the body section:

 !-- tabs views --
         ul class=htabs
                 lia href=#top-view1img src=images/view1.jpg/a/li
                 lia href=#top-view2img src=images/view2.jpg/a/li
         /ul
         div class=tabs
                 !-- View 1 --
                 div class=tab id=top-view1
                         ul id=first-carousel 
 class=first-and-second-carousel jcarousel-
 skin-tango
                                 liSomething/li
                                 liSomething/li
                                 liSomething/li
                         /ul
                 /div
                 div clas=tab id=top-view2
                         ul id=view2-carousel 
 class=first-and-second-carousel jcarousel-
 skin-tango
                                 liSomething/li
                                 liSomething/li
                                 liSomething/li
                         /ul
                 /div

 When i see the generated code in Firefox, it displays this for the
 second one:
 ul class=jcarousel-list jcarousel-list-horizontal id=view2-
 carousel style=width: 60px; left: 0px;

 So how do i fix this?

 I saw 2 answers, but i can't apply them, because i don't know how.
 First:
 From: Bhaall

 Forcing’ the width of the UL just after rendering the carousel does
 the trick, BTW:

 $(’ul#first-carousel’).css(”width”,”1008px”);
 $(’ul#second-carousel’).css(”width”,”1008px”);

 Second:
 From:John Fiala

 I’ve been using multiple carousels within tabs – the way I handle it
 is that I don’t initialize a carousel on page load – I initialize it
 when the tab is displayed. That way, it all generates nicely.

 Looking forward to trying out this version in the near future.

 Anyone can help me just to put the code in the right place? Or have
 any solution for this?

 thanks in advance


[jQuery] Re: Switching a tabs content from a remote source to a local source

2009-07-23 Thread Klaus Hartl

That shouldn't happen and a similiar bug was fixed for IE long time
ago. Which browser do you encounter this bug in and which version of
jQuery UI do you use?


--Klaus



On 22 Jul., 19:22, WR willrya...@googlemail.com wrote:
 It seems that if you change the url of a tab from a remote source
 (ajax request) to a local source
 i.e. ('#myTabs').tabs('url', 1, '#myLocalContentDiv');

 When you then click on this tab, it makes an ajax request 
 (tohttp://myURL/#myLocalContentDiv) rather than simply showing the local
 content. This in effect reloads the entire page into the tab.

 Any way round this, or shall I report this as a bug?

 Thanks.


[jQuery] Re: UI Tabs and xStandard Object

2009-07-20 Thread Klaus Hartl

Could you try this?
http://docs.jquery.com/UI/Tabs#...my_slider.2C_Google_Map.2C_sIFR_etc._not_work_when_placed_in_a_hidden_.28inactive.29_tab.3F


--Klaus



On 19 Jul., 15:25, blackmeta...@googlemail.com
blackmeta...@googlemail.com wrote:
 Hi
 I seem to have found the following bug.

 (I am using the the latest versions of all products mentioned)

 When using jQuery UI Tabs with the following code in one tab, I then
 select another tab then selected the first tab again the content of
 the xStandard object is lost or reverts to the initial value. All
 other form values on the tab are sill preserved as expected.

 object type=application/x-xstandard id=editor1 width=100%
 height=550 codebase=http://xxx/XStandard/
 XStandard.cab#Version=2,0,0,0 name=content
 param name=Value value=enter text /
 /object

 The object also flickers a bit when scrolling the page.
 I have encountered these problems in Firefox and Chrome so far but is
 fine in IE8.

 Not sure if this is a UI or Browser bug.
 Can anyone shed some light on this problem as I don't really what to
 have to recommend IE8.
 Cheers


[jQuery] Re: Jquery UI Tabs and Ajax

2009-07-16 Thread Klaus Hartl

$(#tabs).tabs();

should be just fine, the type of tab is detected automatically. Unless
you're using a very, very old version of Tabs.

--Klaus



On 17 Jul., 00:49, havanna thomas.blas...@diacs.de wrote:
 Hi together,
 I tried it in the group Jquery UI - but nobody answer there?!

 I'm really new to jQuery and UI. What I'm trying is to build a view in
 CakePHP with the jQuery UI Tabs. The first part, integration the
 informations from my Cake controller in Tab 1 to 4 is working.
 In Tab 5 and Tab 6 I want to show informations which are in relation
 to the dataset of Tab1 to Tab4. I.e. Im calling a Post-View. In Tab 5
 I want to show the attachements (1 : n relation).

 So I do the following:
   div id=tabs
     ul
       lia href=#tab-1span?php echo __('Details'); ?/span/
 a/li
       lia href=#tab-2span?php echo __('Fittings'); ?/
 span/
 a/li
       lia href=#tab-3span?php echo __('Conditions'); ?/
 span/a/li
       lia href=#tab-4span?php echo __('Partner'); ?/span/
 a/li
       lia href=/admin/attachements/getlist/?php echo $this-data
 ['Posts']['id]; ?span?php echo __('Object attachements'); ?/
 span/a/li
     /ul

 I think I have to tell the object, that the fiftht tab is an ajax
 call. But I don't know how to mix them:

   script type=text/javascript
     $(function() {
       $(#tabs).tabs();
       $('#tabs').tabs({ remote: true });
     });
         /script

 Have anybody an idea for me?

 Regards Thomas


[jQuery] Re: POST method not working for AJAX Tabs

2009-06-22 Thread Klaus Hartl

$('#tabs').tabs({
spinner: 'Loading...',
ajaxOptions: {
dataType:'text'
}
});

http://docs.jquery.com/UI/Tabs#options


--Klaus


On 21 Jun., 22:18, Hardip hardi.per...@gmail.com wrote:
 a small correction.

 the method is working.

 what wasn't working is the dataType.

 if i set it to json, globally, then Tabs tries to fetch json, not text
 (general HTML).

 how can i make an exception to Tabs.

 [code]
 $.ajaxSetup({
                 type:'post',
                 dataType:'json',
                 cache:false,
                 url:'ajax.php',
                 timeout: 30 * 1000
         })
         $('#tabs').tabs({
                 spinner: 'Loading...',
                 cache: false,
                 dataType:'text'
         });
 [/code]

 aint working...

 On Jun 21, 11:00 pm, Hardip hardi.per...@gmail.com wrote:

  When i override the ajax method with $.ajaxSetup and set the
  type:'post', then consecutive calls to fetch data from the server, by
  Ajax Tabs (http://stilbuero.de/jquery/tabs/), the tab stays
  Loading... forever.

  Firebug shows that a POST request was made and it completed
  successfuly, however, the Tab stays Loading... forever.

  If i set it back to type:'get', the Tabs work fine.

  is it a bug, restriction?

  if it's a restriction, then why?

  workarounds?




[jQuery] Re: jQuery 1.3.2 in IE5.5

2009-06-19 Thread Klaus Hartl

On 18 Jun., 19:32, Rodrigo rodrigo.s.alfo...@gmail.com wrote:
 I'm trying the simplest task ever, like an alert thrown on the $
 (document).ready, but no luck :-(

Also, I slightly remember that alerts are one of the things that do
not work in the standalone IEs...

--Klaus


[jQuery] Re: jQuery Cookie Plugin

2009-06-08 Thread Klaus Hartl

Did you try

$.cookie('the_cookie', 'the_value', { expires: 7 }); // expires after
7 days

?

The expires option will also accept a Date object.


--Klaus



On 8 Jun., 20:27, Richard Walsh deviantstu...@me.com wrote:
 Hey guys, I'm working on a project where I am using the jquery plugin
 that Klaus made. The cookie works very well with the exception that
 when the user closes the browser the cookie expires. I've been trying
 to figure out how I can set the var for expiry so that this doesn't
 happen but I am at a loss. Any advice?


[jQuery] Re: tabs and ajax

2009-05-30 Thread Klaus Hartl

Which version are you using? I've fixed a similiar bug (if not the
same) bug a while ago...

--Klaus



On 28 Mai, 19:30, nextpulse rob...@nextpulse.com wrote:
 I have 3 tabs that each loads using ajax (via href).
 The problem i am having is that while a tab is loading - the user can
 click on another tab (as they should).
 But the tab panel rendering then gets confused - depending how long
 the ajax takes or how quickly the tabs are clicked - the results can
 (and do) come back on a different panel.

 Is this a bug or another way around this?

 I don't want to disable the tab - as it is very reasonable for a user
 to click on the another tab while one is loading.

 My current workaround is to avoid the ajax in the tab and make a call
 via the the 'select'. This works good - but then I lose all the nice
 features of the loader info on the tab display (and the cache).


[jQuery] Re: Submit form when hitting enter

2009-05-22 Thread Klaus Hartl

Why don't you use an input type=image?

--Klaus



On 21 Mai, 06:40, Nic Hubbard nnhubb...@gmail.com wrote:
 I have a form that I built, and I replaced the submit button with an
 image.  When you click the image, it calls the .submit() jQuery
 function and submits the form.

 Because I am not using the normal submit input button, hitting enter
 in most browsers won't submit the form.  I think that users are used
 to this happening, so I would like to replicate this.

 What would I need to do?  Can I trigger the .submit() function when
 the enter button is hit?


[jQuery] Re: Tabs Custom HTML

2009-05-09 Thread Klaus Hartl

Not really. You have to meet only one condition - the list to tabify
has to be nested in a container. You can then put your panels
whereever you want. Of course you can't ask for Themeroller support in
that case.

--Klaus


On 9 Mai, 17:31, kim...@gmail.com kim...@gmail.com wrote:
 Hi everyone,

 With the latest UI release custom html structure for tabs plugin seems
 to be unsupported, can you confirm this?

 Thanks.


[jQuery] Re: val ( ) prefers labels over values?

2009-05-08 Thread Klaus Hartl

w3schools is irrelevant to me. Despite the name it has nothing to do
with the W3C and more often than not I found incorrect/incomplete
information there.

--Klaus



On 8 Mai, 02:52, Marv mcslay...@gmail.com wrote:
 You may be morally correct but the label attribute of the option tag
 is not widely supported:

 http://www.w3schools.com/TAGS/att_option_label.asp

 On May 7, 3:47 pm, Klaus Hartl klaus.ha...@googlemail.com wrote:

  Don't speculate, look 
  up:http://www.w3.org/TR/html401/interact/forms.html#h-17.6

  It's valid.

  This attribute allows authors to specify a shorter label for an
  option than the content of the OPTION element. When specified, user
  agents should use the value of this attribute rather than the content
  of the OPTION element as the option label.

  --Klaus

  On 7 Mai, 20:16, James james.gp@gmail.com wrote:

   I don't think label inside an option is a valid attribute. I'd
   remove that. Is there a reason you're using that? Maybe you should
   consider using the title attribute instead.

   On May 6, 1:42 pm, Michael B.  Williams mbw...@gmail.com wrote:

Consider the following select box:

select id=test
option value=/option
option label=XS value=1XS/option
option label=S value=2S/option
option label=M value=3M/option
option label=L value=4L/option
option label=XL value=5XL/option
option label=0 value=60/option
option label=1 value=71/option
option label=2 value=82/option
option label=3 value=93/option
option label=4 value=104/option
option label=5 value=115/option
option label=6 value=126/option
option label=7 value=137/option
option label=8 value=148/option
option label=9 value=159/option
option label=10 value=1610/option
option label=11 value=1711/option
option label=12 value=1812/option
/select

If I do a $(#test).val(2) on this I would hope it would select S,
but instead it selects 2. Why is this setting the value of the
select box based on the label rather than based on the value
attribute?

I am using Safari 4, by the way.

Thanks


[jQuery] Re: val ( ) prefers labels over values?

2009-05-07 Thread Klaus Hartl

Don't speculate, look up: 
http://www.w3.org/TR/html401/interact/forms.html#h-17.6

It's valid.

This attribute allows authors to specify a shorter label for an
option than the content of the OPTION element. When specified, user
agents should use the value of this attribute rather than the content
of the OPTION element as the option label.


--Klaus



On 7 Mai, 20:16, James james.gp@gmail.com wrote:
 I don't think label inside an option is a valid attribute. I'd
 remove that. Is there a reason you're using that? Maybe you should
 consider using the title attribute instead.

 On May 6, 1:42 pm, Michael B.  Williams mbw...@gmail.com wrote:

  Consider the following select box:

  select id=test
  option value=/option
  option label=XS value=1XS/option
  option label=S value=2S/option
  option label=M value=3M/option
  option label=L value=4L/option
  option label=XL value=5XL/option
  option label=0 value=60/option
  option label=1 value=71/option
  option label=2 value=82/option
  option label=3 value=93/option
  option label=4 value=104/option
  option label=5 value=115/option
  option label=6 value=126/option
  option label=7 value=137/option
  option label=8 value=148/option
  option label=9 value=159/option
  option label=10 value=1610/option
  option label=11 value=1711/option
  option label=12 value=1812/option
  /select

  If I do a $(#test).val(2) on this I would hope it would select S,
  but instead it selects 2. Why is this setting the value of the
  select box based on the label rather than based on the value
  attribute?

  I am using Safari 4, by the way.

  Thanks


[jQuery] Re: $().someFunction(); -- The First Pair of Parentheses?

2009-05-03 Thread Klaus Hartl

$() === $(document)

--Klaus


On 3 Mai, 07:39, kiusau kiu...@mac.com wrote:
 QUESTION:  What does the first pair of parentheses indicate in the
 following statement:

         $().getBrowserInformation();

 BACKGROUND:  I have noticed that their presence or absence can make or
 break JavaScript's acknowledgement of a method's existence on the one
 hand, but seem entirely unnecessary under other circumstances.

 Roddy


[jQuery] Re: How to get JQuery to parse text as HTML

2009-04-21 Thread Klaus Hartl

Try:

$(.targetMe, $(testHTML)).html();

or:

$(testHTML).find('.targetMe').html();

You might get into trouble with that and the html and body tags, not
sure. In that case you had to create your own document fragment...

--Klaus



On 21 Apr., 03:28, default_user ayapej...@gmail.com wrote:
 I'm trying to get jquery to parse some text in a variable as HTML, has
 anyone tried this before and got it to work?  Can this even be done,
 or do I have to parse as text?

 CODE

 testHTML = htmlhead/headbodyulli class='targetMe'TESTING/
 li/ul/body/html;

 testGetHTML = $(.targetMe, testHTML).html();

 alert( testGetHTML );

 /CODE


[jQuery] Re: tabs collapsed by default on open

2009-04-16 Thread Klaus Hartl

On 16 Apr., 20:38, robintrain...@yahoo.com robintrain...@yahoo.com
wrote:
 Hello everyone. Is there a way to have tabs created in jQuery that are
 collapsed when the page loads? I use this:

 $(document).ready(function(){
 $(#tabs).tabs({ collapsible: true

 });
 });

 to allow the user to click on the tab to collapse it once the page
 loads. But how do I get the tab content to be hidden to begin with?

Use:

$(document).ready(function(){
$(#tabs).tabs({
collapsible: true,
selected: -1
});
});

You don't necessarily have to use collapsible in this case by the way.

--Klaus


[jQuery] Re: Calling a function from a non-jQuery .JS file

2009-04-15 Thread Klaus Hartl

On 14 Apr., 19:15, dhtml dhtmlkitc...@gmail.com wrote:
  problem is that that Dreamweaver method is using document.write which
  can cause a problem depending on where the function is being called
  and which is usually avoided in jQuery land.

 Calling document.write in a jQuery ready callback won't work
 consistently.

Didn't I say just that?


 If you want to format a local date, what is wrong with just having:-

 var todayEl = document.getElementById(today);
 todayEl.innerHTML = formatDate(new Date);

I believe the question was not about how to properly localize a date.


--Klaus


[jQuery] Re: Calling a function from a non-jQuery .JS file

2009-04-14 Thread Klaus Hartl

On 14 Apr., 15:41, MorningZ morni...@gmail.com wrote:
 So what is the error

The error is obviously that toDate is not a jQuery method. Another
problem is that that Dreamweaver method is using document.write which
can cause a problem depending on where the function is being called
and which is usually avoided in jQuery land.

Since toDate is not (yet) a jQuery method, let's make one:

(function($) {

var days = [
'Sunday',
'Monday',
'Tuesday',
'Wednesday',
'Thursday',
'Friday',
'Saturday'
];

var months = [
'January',
'February',
'March',
'April',
'May',
'June',
'July',
'August',
'September',
'October',
'November',
'December'
];

$.fn.toDate = function() {
var now = new Date;
return this.html('pToday\'s Date:br /' + days[now.getDay
()] +
', ' + now.getDate() + ' ' + months[now.getMonth()] + ' 
' +
now.getFullYear() + '/p');
};

})(jQuery);


Now you can use it like:

$(document).ready(function() {
   $('#today').toDate();
});


--Klaus


[jQuery] Re: JQuery UI tabs and pagination

2009-04-11 Thread Klaus Hartl

Use:

$(.to_be_replaced, ui.panel).load(this.href);


--Klaus



On 11 Apr., 12:00, Claudio Poli masterk...@gmail.com wrote:
 hi everyone,
 I've this situation: an X number of tabs; in tabs content there's a
 div classed .to_be_replaced and links for paginating.
 when I click on a link it should replace the content
 of .to_be_replaced.

 The problem here is that every div.to_be_replaced gets replaced, and
 not only the one that belongs to the currently shown tab.

 this is the code:

     $('#tabcontainer').tabs({
         show: function(event, ui) {
             $('div.pagination a', ui.panel).live('click',
             function() {
                 $.blockUI({
                     message: null
                 });
                 $(ui.panel, .to_be_replaced).load(this.href);
                 return false;
             });
         }
     });

 any help is appreciated, thanks.


[jQuery] Re: How to tell apart focus event

2009-04-07 Thread Klaus Hartl

In the past I distinguished between true and triggered events via the
e.clientX property (a triggered event has no such property). Not sure
if it's the same with focus events (especially since you're calling
elem.focus and there is no elem.click) and if there is a better way...

--Klaus


On 6 Apr., 04:24, bob xoxeo...@gmail.com wrote:
 Hi,
 form
        Name: input type=text id=my_name name=my_name
 /form

 Is it possible to tell apart focus event?

 jQuery(#my_name).focus(function (evt) {

         if( ??? ){

                 //execute this if focus was triggered by user clicking on the 
 text
 field
         }
         else {
                 //execute this if focus was triggered by method call like this
                 //document.getElementById(my_name).focus();

         }

 });




[jQuery] Re: All div content showing up in jQuery Tabs

2009-04-03 Thread Klaus Hartl

There's no need for all this ranting. You're simply not meeting the
markup requirements to make the tabs work.

A tab has to look like:

lia href=#fragment-identifierspanA Tab/span/a/li

I m pretty sure the documentation is showing this fact and I don't
understand why you took straight code out of the example and then
changed it to not work. Indeed Nowhere in
the docs does it say you need to add code to show the first default
tab and
div. because you don't need to as long as you're using the proper
markup.


--Klaus



On 3 Apr., 07:32, expresso dschin...@gmail.com wrote:
 I mean really if you take the straight code out of the example and try to run
 this, it doesn't even work!  So how are we to even use the docs?  Under the
 Example here:http://docs.jquery.com/UI/Tabs#events that code works there
 but when I try this in my own page, I get the same issues.

 !DOCTYPE html
 html
 head
   link type=text/css
 href=http://jqueryui.com/latest/themes/base/ui.all.css; rel=stylesheet /
   script type=text/javascript
 src=http://jqueryui.com/latest/jquery-1.3.2.js;/script
   script type=text/javascript
 src=http://jqueryui.com/latest/ui/ui.core.js;/script
   script type=text/javascript
 src=http://jqueryui.com/latest/ui/ui.tabs.js;/script
   script type=text/javascript
   $(document).ready(function(){
     $(#tabs).tabs();
   });
   /script
 /head
 body style=font-size:62.5%;

 div id=tabs
     ul
         liOne/li
         liTwo/li
         liThree/li
     /ul
     div id=fragment-1
         pFirst tab is active by default:/p
         precode$('#example').tabs();/code/pre
     /div
     div id=fragment-2
         Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam
 nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat
 volutpat.
         Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam
 nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat
 volutpat.
     /div
     div id=fragment-3
         Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam
 nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat
 volutpat.
         Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam
 nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat
 volutpat.
         Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam
 nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat
 volutpat.
     /div
 /div
 /body
 /html

 Thanks.  And this is what really gets to me about the docs.  Nowhere in
 the docs does it say you need to add code to show the first default tab and
 div.  In fact the docs show you an example with example code of tabs working
 without it.

 So then why should we assume we have to write all this extra code just to
 specify the default to load and others hidden when the docs don't even show
 that?

 I can see all the events, etc. on that page, but nowhere especially in the
 examples does it say you have to do anything other than add the following
 script to your page along with the structure of hyperlink-to-div id matchup:

   $(document).ready(function(){
     $(#tabs).tabs();
   });
   /script

 so how does one infer to have to create all this extra code to get basic
 features to work when the own docs are showing you none of that!?

 If I have to hack in more jQuery to do this, then the docs should be
 forthcoming and tell me this instead of giving me examples that essentially
 point me in a direction of it works like this instead of you need to code
 a ton more to get this to work like this type of deal.  How do I know that?
 I'm not trying to do anything here outside of get the basic tabs working and
 default div to show!  By what I infer from the docs, this is all I need!

 I mean is that example ONLY working because it's using the jquery css (link
 type=text/css href=http://jqueryui.com/latest/themes/base/ui.all.css;
 rel=stylesheet /) in there and the jQuery tabs plugin can work like that
 IF you only use that css and anything outside that you must code your own
 logic to your own css?  I don't get this or infer that!



 thedad...@gmail.com wrote:

  maybe this tutorial can help you .

 http://15daysofjquery.com/jquery-online-movie-tutorial-by-john-resig/29/

  On 4月3日, 上午10时24分, expresso dschin...@gmail.com wrote:
  For some reason, when my first div loads, I'm seeing all 3 text show up
  even
  though they're in different div containers:

    script type=text/javascript
        $(document).ready(function() {
        $('#Tabs div:Form1Content').show();
        $('#Tabs').tabs({ fx: { opacity: 'toggle'} });
        });
    /script
      div id=Tabs
          ul
              li id=PTab runat=server #Form1Content
  Images/Product/tab1.gif  /li
              li id=OTab runat=server #Form2Content
  Images/Product/tab2.gif  /li
              li id=RTab runat=server #Form3Content
  Images/Product/tab3.gif  /li
          /ul
          div id=TabsMain
              div id=PContent
  

[jQuery] Re: All div content showing up in jQuery Tabs

2009-04-03 Thread Klaus Hartl

On 3 Apr., 20:01, expresso dschin...@gmail.com wrote:
 In fact you know what the problem is?  The damn documentation doesn't tell
 you that you MUST use the stylesheets given.  All I assumed was is that I
 had to have the matching IDs and correct jQuery which I DID.

 What if we do not want to use those styles.  I assumed the jQuery behind
 this injected the active styles it needs out of the box.  It was not
 inferred that I must use that specific style sheet.  In fact, now that I
 know this, that should be updated in the documentation because most of us
 will not use those styles.  I'm using images in mine.  But to know that if
 you remove those styles in the demo would break this?  No way would I infer
 that.

In the Tabs documentation section Overview [1] under *Dependencies*
you'll find the following:

Required CSS:

.ui-tabs .ui-tabs-hide {
 display: none;
}

[1] http://docs.jquery.com/UI/Tabs#overview


--Klaus


[jQuery] Re: All div content showing up in jQuery Tabs

2009-04-03 Thread Klaus Hartl

On 3 Apr., 20:12, expresso dschin...@gmail.com wrote:
 now I have to figure out how to get rid of these imposed styles.

As already mentioned above, the only thing you will need for tabs to
work is the following rule:

.ui-tabs-hide {
 display: none !important;
}

So the only thing that's imposed here seems to be our free time spent
to help creating a rock-solid ui library. I won't go into detail why
we chose to use a class for hiding tab content.


--Klaus


[jQuery] Re: Good Server-Side tabs to compliment jQuery tabs

2009-04-01 Thread Klaus Hartl

You can just use the CSS used by jQuery UI by adding the necessary
classes to the HTML right away. Here's an example of the static HTML:
http://jquery-ui.googlecode.com/svn/trunk/tests/static/tabs/tabs.html

You can easily create themes with Themeroller:
http://jqueryui.com/themeroller/

--Klaus



On 1 Apr., 19:07, expresso dschin...@gmail.com wrote:
 Trying to find a decent solution to server-side tabs for when users have
 JavaScript turned off.  I'll be using jQuery tabs but looking for a CSS tab
 solution (that allows images for the tabs also) that works cross browser.

 Anyone used any decent CSS scripts or have an example of actual tabs you've
 deployed that have been working for you in case users have JScript turned
 off?

 Looking for a good CSS tab solution that will be used on a huge e-commerce
 site so this has to be very reliable.

 I guess I will have those tabs sitting in the page.  And then jQuery can
 just use the same list elements and enact on them if the user has JScript
 turned on?
 --
 View this message in 
 context:http://www.nabble.com/Good-Server-Side-tabs-to-compliment-jQuery-tabs...
 Sent from the jQuery General Discussion mailing list archive at Nabble.com.


[jQuery] Re: Work on one specific node and not on the window.document

2009-03-31 Thread Klaus Hartl

On 31 Mrz., 08:38, Steven Yang kenshin...@gmail.com wrote:
 do you have a special reason to find an element by id in a specific node?isn't
 id suppose to be unique in the whole document?

Could think of: It may have different behavior depending on wether
it's in the main content or the sidebar.


[jQuery] Re: AJAX - ignore mime type

2009-03-31 Thread Klaus Hartl

You should be able to use the XmlHttpRequest.responseText property,
it'll give you the server response as string...

--Klaus



On 31 Mrz., 10:43, the_woodsman elwood.ca...@gmail.com wrote:
 Thanks for your responses guys.

 James - I think I'm trying to do the opposite, my ajax call returns
 XML, and I want to treat it like plain HTML - but I'll look at your
 link and see if it helps, thanks!

 Klaus - the API exists already and is used by other client technology,
 I don't have free reign to change it...  and I shouldn't have to,
 everything works fine when i send XML without the mime type!
 I just need to ignore the XML mime type, and everything would be
 sorted!!!

 On Mar 31, 6:30 am, Klaus Hartl klaus.ha...@googlemail.com wrote:

  I am wondering why the server would not serve html in the first place.

  --Klaus

  On 30 Mrz., 15:37, the_woodsman elwood.ca...@gmail.com wrote:

   Hi,

   My ajax requests return xml, with the corresponding mime type.

   I'm using $.get, as so:

           $.get(
                                                   $(this).attr('href'),
                                                   function(data, textStatus)
                                                   {
                                                           
   $('#requestArea').val(data);
                                                   },
                                                   'html' //type, correct?
                                           );

   $('#requestArea').val(data) sets a text area to say [object
   XMLDocument]

   So it seems my setting the type to html does nothing!

   I've played around with this a bit, including using other ajax methods
   apart from .get(), with the same results.

   Am I missing something here?

   Thanks in advance!




[jQuery] Re: AJAX - ignore mime type

2009-03-30 Thread Klaus Hartl

I am wondering why the server would not serve html in the first place.

--Klaus




On 30 Mrz., 15:37, the_woodsman elwood.ca...@gmail.com wrote:
 Hi,

 My ajax requests return xml, with the corresponding mime type.

 I'm using $.get, as so:

         $.get(
                                                 $(this).attr('href'),
                                                 function(data, textStatus)
                                                 {
                                                         
 $('#requestArea').val(data);
                                                 },
                                                 'html' //type, correct?
                                         );

 $('#requestArea').val(data) sets a text area to say [object
 XMLDocument]

 So it seems my setting the type to html does nothing!

 I've played around with this a bit, including using other ajax methods
 apart from .get(), with the same results.

 Am I missing something here?

 Thanks in advance!


[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: Wouldn't inArray() be more intuitive if called arrayPosition()?

2009-03-23 Thread Klaus Hartl

Read inArray as positionInArray rather than isInArray here...

--Klaus


On 23 Mrz., 21:25, MorningZ morni...@gmail.com wrote:
 Yeah, like what he is suggesting is to return a boolean value   so
 now if someone wants the position of the item, it would be a whole
 separate function to do so

 to me, one single function and checking the value is more intuitive,
 maybe if it was named something more inline with what it returns (like
 for instance, indexOf) makes more sense, but none the less the
 function kills two birds with one stone

 On Mar 23, 4:19 pm, Eric Garside gars...@gmail.com wrote:

  Honestly, inArray and arrayPosition are equally intuitive to me. If
  the value has a position in the array, then it is, by definition, in
  the array. inArray returning the array position is a similar check,
  but with a more robust ouput. Again, as MorningZ said, you can simply
  check it's value using a simple gt operator. I honestly don't care too
  much about inArray returning a non-boolean value which may be
  unintuitive to some users. After all, the docs are there for a
  reason.

  On Mar 23, 3:51 pm, Mike521 mi...@favorfavor.com wrote:

   I'm not discussing whether I can or can't use it the way it is, I'm
   discussing which way is more intuitive.

   On Mar 23, 3:18 pm, MorningZ morni...@gmail.com wrote:

just can't say

if ($.inArray(value, array)  -1) {
   // found in array?

}

On Mar 23, 2:59 pm, Mike521 mi...@favorfavor.com wrote:

 I was about to use inArray (http://docs.jquery.com/Utilities/
 jQuery.inArray) to determine if an element was in an array or not, but
 I realized I can't use it as a true/false response since it returns
 the position (and could return 0 if the element was found in position
 0 - returns -1 if not found). I was expecting something with the same
 functionality as the PHP function in_array (http://us3.php.net/
 in_array)

 I know it's a minor point but wouldn't it be more intuitive if called
 arrayPosition? with a name like that I'd expect the functionality it
 has now.




[jQuery] Re: ui tabs how to link to a new page

2009-03-22 Thread Klaus Hartl


http://docs.jquery.com/UI/Tabs#...open_a_tab_in_a_new_window_instead

--Klaus


On 22 Mrz., 18:16, David omertacod...@gmail.com wrote:
 Hi all,

 Is it possible to if you click a tab i get to a new page ? i've tried
 the option to load a page into the tab content but that's not what i'm
 looking for.

 basically if i click on tab 1 it goes to page1.php, tab 2 to page2.php

 If someone could help me out ... thanks


[jQuery] Re: ui tabs how to link to a new page

2009-03-22 Thread Klaus Hartl

Well, then you will have to adapt that script and use window.open...

--Klaus


On 22 Mrz., 21:07, David omertacod...@gmail.com wrote:
 This opens the external page IN the tabs page ... does not help me

 On 22 mrt, 20:52, Klaus Hartl klaus.ha...@googlemail.com wrote:

 http://docs.jquery.com/UI/Tabs#...open_a_tab_in_a_new_window_instead

  --Klaus

  On 22 Mrz., 18:16, David omertacod...@gmail.com wrote:

   Hi all,

   Is it possible to if you click a tab i get to a new page ? i've tried
   the option to load a page into the tab content but that's not what i'm
   looking for.

   basically if i click on tab 1 it goes to page1.php, tab 2 to page2.php

   If someone could help me out ... thanks




[jQuery] Re: Help tracking down error in IE8 / jquery 1.3.2

2009-03-21 Thread Klaus Hartl

On 20 Mrz., 16:43, Martijn Houtman martijn.hout...@gmail.com wrote:
 On Mar 20, 2009, at 4:35 PM, Adam Drew wrote:

  name = outline
  value = 0 none !important

  Those values breaks it every time it comes around..

  I'm going to see what is setting these values..

 http://www.w3schools.com/CSS/pr_outline.asp

 The value you are setting seems unsupported. Try either outline-
 style: none or 0px as width.

Often enough I found things that are just wrong on W3Schools and
they're in no way related to the W3C despite that they're trying to
steal some reputation by calling themselves W3Schools.

The value in question is valid, since outline is the shorthand for the
single outline properties, e.g.

outline: 0 none;

would expand to:

outline-width: 0;
outline-style: none;

That said, using both is redundant, since style doesn't matter if the
width is 0 and vice versa.

http://www.w3.org/TR/CSS21/ui.html#dynamic-outlines


--Klaus


[jQuery] Re: How to select nested tabs

2009-03-21 Thread Klaus Hartl

The problem might be that you're selecting too much with your first
selector, a common error.

http://docs.jquery.com/UI/API/1.5.3/Tabs#...the_call_to_tabs_tabify_all_li_elements_-_even_those_in_a_panel_-_although_I_did_not_want_to_create_nested_tabs.3F


--Klaus


On 20 Mrz., 20:03, randy...@gmail.com randy...@gmail.com wrote:
 I have created nested tabs using Tabs 3. Trying to select the second
 nested tab by default. Doing this does not work...

 $(document).ready(function() {
         $('#container ul').tabs(1);
         $('#container-2 ul').tabs(2);

 })

 The second container is ignored and the first nested tab is selected.


[jQuery] Re: JQuery selectors and Umlaute

2009-03-20 Thread Klaus Hartl

Even if it would work I recommend to avoid Umlaute. They're invalid in
ids.

http://www.w3.org/TR/REC-html40/types.html#type-name


--Klaus



On 20 Mrz., 16:52, Karl Swedberg k...@englishrules.com wrote:
 Which version of jQuery are using? Are you seeing any JavaScript  
 errors? I just tested this and it worked fine:

 result:http://jsbin.com/otaya/

 code:http://jsbin.com/otaya/edit

 --Karl

 
 Karl Swedbergwww.englishrules.comwww.learningjquery.com

 On Mar 20, 2009, at 5:57 AM, srudin wrote:



  I'm trying to select an element with an id containing a German Umlaut:

  input id=Bestätigung.../

  Unfortunately the jquery selector $(#Bestätigung) is not returning
  any result. Is there a trick to make this work or is it not possible
  at all?




[jQuery] Re: Select class=class1 class2 using jQuery

2009-03-18 Thread Klaus Hartl

http://www.w3.org/TR/CSS21/selector.html#class-html

--Klaus


On 19 Mrz., 00:04, Karl Rudd karl.r...@gmail.com wrote:
 Yes, it's standard CSS selector behaviour, so it's also standard
 jQuery behaviour.

 Karl Rudd

 On Thu, Mar 19, 2009 at 6:32 AM, bill123 bi...@ssec.wisc.edu wrote:

  I need to select an element like this:

     div class=class_1 class_a/div

  and I've found that both of the following work:

     $(.class_a).filter(.class_1).css(background-color, red);

     $(.class_a.class_1).css(background-color, red);

  The first one makes sense and is documented on the website.  But the
  second one isn't documented anywhere as far as I can tell.

  My question is this: is this, i.e.

    $(.class_a.class_1)

  intended, documented behavior or is this some fluke that is likely to
  disappear?  Is there a URL where this behavior is documented?  I would
  like to use the second selector syntax (i.e., $(.class_a.class_1) )
  but don't want to rely on it if it's likely to disappear.

  Thanks!




[jQuery] Re: Safari + triggerTab() = fail

2009-03-11 Thread Klaus Hartl

History is broken in Safari 3, one of the reasons it was taken out of
UI Tabs.

--Klaus



On 11 Mrz., 21:46, ZAP michael...@gmail.com wrote:
 Hello -

 I'm using Klaus' Tabs plugin (Version: 2.7.4) with jQuery 1.2.6, but
 the triggerTab() function just isn't working for me in Safari 3. No
 matter how I create Back and Next buttons or links, Safari instead
 tries to load a new page (e.g.,http://mydomain.com/?#start) instead
 of switching tabs. Clicking the tab headers works as expected in
 Safari, and everything works properly in all other tested browsers.

 I've tried various methods to make these links work in Safari, such
 as:
 input type=button id=back2 class=submit value=laquo; back
 onclick=$('#formtabs').triggerTab(1);return false;/
 a href=# onclick=$('#formtabs').triggerTab(2);return
 false;laquo; back/a

 What might be the cause of this, and more importantly what might be
 the solution?

 Thanks in advance for your replies.

 ZAP


[jQuery] Re: cancelling default click handler for label/

2009-03-10 Thread Klaus Hartl

On 10 Mrz., 16:00, Karl Swedberg k...@englishrules.com wrote:
 label for =myid
         input type=checkbox id=myid name=myid /
 /label

 Not saying that I prefer this way, just that it's possible.

 --Karl

Cool. I've never tried that...


--Klaus


[jQuery] Re: cancelling default click handler for label/

2009-03-09 Thread Klaus Hartl

One reason not doing it is probably because IE only supports
explicitly associated labels.

--Klaus



On 9 Mrz., 04:13, Karl Swedberg k...@englishrules.com wrote:
 having the input inside the label is perfectly valid.

 http://www.w3.org/TR/html401/interact/forms.html#h-17.9.1

 To associate a label with another control implicitly, the control  
 element must be within the contents of the LABEL element. In this  
 case, the LABEL may only contain one control element. The label itself  
 may be positioned before or after the associated control.

 I don't prefer doing it this way for my own sites, but it's not  
 incorrect.

 --Karl

 
 Karl Swedbergwww.englishrules.comwww.learningjquery.com

 On Mar 8, 2009, at 9:49 PM, David Muir wrote:



  And why is the input within the label?

  I was under the impression that the correct format is:
  labelMy Label/labelinput type=checkbox /

  To have the label select the checkbox:
  label for=my-checkboxMy Label/labelinput id=my-checkbox  
  type=checkbox /

  David

  MorningZ wrote:
  is there any reason why you couldn't use a span instead of a
  label ?

  On Mar 8, 8:57 pm, Bill bllfr...@gmail.com wrote:

  I have markup that looks like this:

  div id=phrase:witness%2Bwhereof class=as-s-comp
     label class=checkbox title=witness whereof
         input type=checkbox value=witness whereof/
         witness whereof
     /label
     a class=cl href=#(4104)/a
  /div

  When I click anywhere within the label, the checkbox toggles from  
  its
  previous state. I'd like to cancel this behavior, so that clicking
  within the label has no effect on the checkbox. How would I use  
  jQuery
  to accomplish this?

  Thanks in advance for any help with this.

  --Bill




[jQuery] Re: [Exception... Component returned failure code: 0x80070057 (NS_ERROR_ILLEGAL_VALUE)

2009-03-09 Thread Klaus Hartl

Looks like you tried to make a cross-domain ajax request.

--Klaus


On 9 Mrz., 21:14, Tom  Shafer tom.sha...@gmail.com wrote:
 what does this error mean

 [Exception... Component returned failure code: 0x80070057
 (NS_ERROR_ILLEGAL_VALUE) [nsIXMLHttpRequest.open] nsresult:
 0x80070057 (NS_ERROR_ILLEGAL_VALUE) location: JS frame 
 ::http://tjshafer.com/projects/boyd/js/jquery-1.3.2.min.js::
 anonymous :: line 19 data: no]

 -tj


[jQuery] Re: Modify hash in Tabs plugin

2009-03-05 Thread Klaus Hartl

If I remember correctly - haven't had a look at Tabs 2 for quite some
time - if you set the title attribute on an anchor, the hash is
derived from that.

a title=Inicio href=html/inicio.html.../a

= #Inicio

White space will be converted to an underscore...


--Klaus



On 5 Mrz., 09:00, fonoteca nas...@gmail.com wrote:
 I'm learning about JQuery and I'm absolute begginer.
 I've looking for help about one issue that imagine is easy but I can't
 find the answer till now.
 I supose Klaus Hartl has the solution for this: How I modify the hash
 of the tabs plugin?

 I'm using the version 2 with the remote option:true.

 By default appears numbers when I need show the title. With the remote
 option and I don't know how make to appear the title of the link in
 the hash instead the number.

 At last, but no at least: of course sorry about my english. It's not
 my native languaje.

 I'm making tests and this is my code:

 html
     head
         meta http-equiv=Content-Type content=text/html;
 charset=utf-8
         meta http-equiv=Content-Style-Type content=text/css
         meta http-equiv=Content-Script-Type content=text/
 javascript

         titleMy web/title

         script src=js/jquery-1.2.6.js type=text/javascript/
 script
         script src=js/jquery.history_remote.js type=text/
 javascript/script
         script src=js/jquery.tabs.js type=text/javascript/
 script
         script type=text/javascript
             $(document).ready(function() {
                 $('#menu').tabs({ remote: true, fxFade: { height:
 'show', opacity: 'show' }, fxSpeed: '4000'});
             });
         /script

 script type=text/javascript
   $(document).ready(function($) {
    $(#fulla).fadeIn('slow');
   });
 /script

         link rel=stylesheet href=css/fonoteca.css type=text/css
 media=print, projection, screen
         !-- Additional IE/Win specific style sheet (Conditional
 Comments) --
         !--[if lte IE 7]
         link rel=stylesheet href=css/fonoteca-ie.css type=text/
 css media=projection, screen
         ![endif]--

     /head
     body
      !-- Inicio fulla --
      div id=fulla class=fulla style=display:none
       !-- Inicio container --
       div id=container class=container
        !-- Inicio header --
        div id=header class=header
         Title
       /div
        !-- Fin header --

        !-- Inicio menu --
         div id=menu class=menu
             ul id=tabs class=tabs
                 lia href=html/inicio.html
 title=IniciospanInicio/span/a/li
                 lia href=html/voces.html
 title=VocesspanVoces de la Historia/span/a/li
                 lia href=html/anuncios.html
 title=AnunciosspanAnuncios/span/a/li
                 lia href=html/gazapos.html title=Gazapos y
 aneacute;cdotasspanGazapos/span/a/li
                 lia href=html/sintonias.html
 title=Sintoniacute;asspanSintoniacute;as/span/a/li
                 lia href=html/emisoras.html
 title=EmisorasspanEmisoras/span/a/li
             /ul
         /div
         !-- Fin menu --
         /div
         !-- Fin contingut --
       /div
       !-- Fin container --

       !-- Inicio side --
       div id=side class=side
         Lateral
       /div
       !-- Fin side --
       !-- Inicio pie --
       div id=pie class=pie_bis
         Pie de la pagina
       /div
       !-- Fin pie --
      /div
      !-- Fin fulla --
     /body
 /html


[jQuery] Re: What do you recommend to generate UUID with jQuery ?

2009-03-05 Thread Klaus Hartl

I've been using the data method for this, you need to pass a DOM
element though:

var uuid = $.data(el);

--Klaus



On 6 Mrz., 03:48, Mike Alsup mal...@gmail.com wrote:
        What do you recommend to generate UUID with jQuery ?

        Thank you !

 I've been using something like this:

 function uid() {
     var result='';
     for(var i=0; i32; i++)
         result += Math.floor(Math.random()*16).toString(16).toUpperCase
 ();
     return result

 }




[jQuery] Re: How to use anchor text as title attribute?

2009-03-04 Thread Klaus Hartl

 $('a').attr('title' , function() { $(this).text() } );

 I must be missing something simple here.

Yes, a return statement.

$('a').attr('title' , function() { return $(this).text(); });


--Klaus


[jQuery] Re: jquery ajax tabs with normal forms

2009-03-02 Thread Klaus Hartl

You will have to use the Form plugin.

--Klaus



On 2 Mrz., 12:48, Iswaria iswar...@gmail.com wrote:
 Hi,

 I am using jquery ajax tabs.

 In one of the tab, i am using a form ( i didn't use jquery form).

 while submitting the form, it is going a fresh page. But i want to
 retain the tabs.

 Any suggestions?

 Regards,
 Iswaria


[jQuery] Re: jQuery tabs problem with language

2009-02-27 Thread Klaus Hartl
You have a # too much in your panel ids... Should read:

div id=tabs-1 ...


--Klaus


On 27 Feb., 17:35, hitautodestruct yotam.pr...@gmail.com wrote:
 Hi,

 I have a problem implementing jQuery tabs using hebrew content in the
 li and div elements.
 I get the error jQuery UI Tabs: Mismatching fragment identifier when
 clicking on the tabs.

 Everything works perfect when the text is english but when I have
 hebrew in it it returns the above error.

 I am using jQuery 1.2.6 and UI version 1.5.3.
 Code:
                                                         div id=tabHolder
                                                                 ul
                                                                         
 lia href=#tabs-1דוגמא/a/li
                                                                         
 lia href=#tabs-2דוג/a/li
                                                                         
 lia href=#tabs-3דגמא/a/li
                                                                         
 lia href=#tabs-4עוד דוגמא/a/li
                                                                         
 lia href=#tabs-5דוגמא דוגמא/a/li
                                                                 /ul
                                                                 div 
 id=#tabs-1 class=                                                        
            עברית
                                                                 /div
                                                                 div 
 id=#tabs-2
                                                                               
                                                                   עברית
                                                                 /div
                                                                 div 
 id=#tabs-3                                                                 
      עברית
                                                                 /div
                                                                 div 
 id=#tabs-4
                                                                               
                                                                   עברית
                                                                 /div
                                                                 div 
 id=#tabs-5
                                                                         עברית
                                                                 /div

 Is there a tweak or some option to internationalize the tabs?
 I am using UTF-8 encoding on the page.

 Thanks

[jQuery] Re: Can't get onclick of tab to fire....

2009-02-26 Thread Klaus Hartl

On 26 Feb., 16:14, Richard D. Worth rdwo...@gmail.com wrote:
 Your code sample doesn't have version numbers. Can you verify you're using
 compatible versions of jQuery and jQuery UI?

 jQuery UI 1.5.3 is only compatible with jQuery 1.2.6
 jQuery UI 1.6rc6 is only compatible with jQuery 1.3+

Judging from the code it's even Tabs 2 before UI...

--Klaus


[jQuery] Re: UI/Tabs Losing selected tab on updatepanel postback

2009-02-25 Thread Klaus Hartl

You're giving way too less information to answer the question if this
has been sorted out. Maybe it needs to be sorted out in your own code.

Please provide a pastebin or test page.

--Klaus



On 25 Feb., 11:22, Intelligent Penguin phalling...@googlemail.com
wrote:
 Hello

 I've got some of the UI/Tabs (which are very nice, really like them)
 on a page that is encased in an UpdatePanel.  On doing a partial
 postback, the selected tab reverts to it's initial state (ie, if I do
 a partial postback from tab #2, it reverts to displaying tab #1).

 Has this been sorted already?

 Many thanks, P


[jQuery] Re: UI/Tabs Losing selected tab on updatepanel postback

2009-02-25 Thread Klaus Hartl

On 25 Feb., 14:11, David Muir davidkm...@gmail.com wrote:
 I think what P is referring to is what using cookies enables: remember
 what tab you were on when refreshing the page.

 Which makes me wonder, why not have an option to have the hash set
 instead of using a cookie?

 eg
 index.html:

 div class=tabs
     ul
         lia href=#tab1Tab1/a/li
         lia href=#tab2Tab2/a/li
     /ul
     div id=tab1/div
     div id=tab2/div
 /div

 If I type index.html#tab2 in the address bar, it loads the page with
 tab2 selected. Which is great, as it lets me jump to a specific tab from
 a different page, and refreshing the page means that tab2 stays selected.
 Currently we need to use a separate plugin to handle this.

Huh? This functionality is implemented, actually right from the very
beginning...


 Looking
 through the source, it says that the hash is being stripped from the url
 until issue #3808 is fixed. Just checked and 3808 has been fixed, so
 does that mean we can have our hashes again? :-)

That's another bug - related to ajax tabs with a hash in their href
attribute. But that has nothing to do with the hash in the page's url
that contains the tabs.


--Klaus



[jQuery] Re: adding tabs dynamically

2009-02-23 Thread Klaus Hartl

You could add that to the template. Or use the add callback to
populate the tab:

$('#whatever').tabs({
add: function(event, ui) {
$(ui.panel).html( ... )
.find('input'); // do something with these inputs
}
});

It seems you have to use the add callback anyway to get to these
inputs. If you use the template you only wouldn't need the html()
call.

--Klaus


On 23 Feb., 02:29, Paul Georges sinst...@gmail.com wrote:
 awesome, thanks. can't believe i missed that one.

 and as for the content of the tab? if i wanted a tab to always have
 two textboxes, should i modify the template? and then who would i
 access these two input boxes dynamically?

 thanks heaps

 paul

 On Feb 21, 12:41 am, Klaus Hartl klaus.ha...@googlemail.com wrote:

  Why don't you put the desired label in the first place?

  $('#tabs').tabs('add', '#new', 'Label');

  Other than that you could utilize the add callback:

  $('#tabs').tabs({
      add: function(event, ui) {
          // add additional html to the tab
          $('span', ui.tab).html(...);
      }

  });

  Or you can change the tabTemplate option and add that html there...

  --Klaus

  On 20 Feb., 06:01, Paul Georges sinst...@gmail.com wrote:

   hey guys and gals,

  http://docs.jquery.com/UI/Tabs

   followed the above docs but couldn't quite add tabs correctly yet. i
   can add a tab, yes, but then i can't change it's label or innerHTML.
   how can i do this?

   cheers!

   Paul!




[jQuery] Re: jQuery 1.3.2 + Dialog + Tabs = Bug

2009-02-22 Thread Klaus Hartl

Not sure yet what the bug is actually, but I found that the following
fixes it:

setTimeout(function() {
tabdiv.children('#tabs').tabs(select,#tabs-2);
}, 0);

Lead me to changing the order of opening the dialog and selecting the
other tab:

content.dialog('open');
tabdiv.children('#tabs').tabs(select,#tabs-2);

which also works...


--Klaus



On 22 Feb., 02:48, mgl mgl@gmail.com wrote:
 Hi all,

 I've found a bug in jQuery 1.3.2 (or maybe Dialog/Tabs in UI 1.6rc6).

 In my application, I have a dialog with tabs inside of it.  I create
 the dialog and build/setup the elements inside it before it is
 displayed to the user.  Up to jQuery 1.3.1 I haven't had a problem
 with this.  Depending on what sequence of actions activates the
 dialog, a different tab will be selected by default, using the .tabs
 ('select',[tabid]) method.  In some cases, this may happen before the
 dialog is displayed - this is where I've found a bug with jQuery
 1.3.2.  Basically, I get two tabs displayed.  Here's an 
 example:http://jsbin.com/umihi/edit

 If there are only two tabs, there's no way to fix it (in the example
 linked above, you can click on the 3rd, and it's okay after that).

 Is there any chance this has something to do with the latest changes
 to the Sizzle library?


[jQuery] Re: jQuery 1.3.2 + Dialog + Tabs = Bug

2009-02-22 Thread Klaus Hartl

Got it: Changes to the :visible selector caused this. Since you're
selecting the tab while the content is still hidden, the following
filter wasn't working correctly anymore:

filter(':visible')

Changed to

filter(':not(.ui-tabs-hide)')

which is more reliable anyway.


--Klaus



On 22 Feb., 12:03, Klaus Hartl klaus.ha...@googlemail.com wrote:
 Not sure yet what the bug is actually, but I found that the following
 fixes it:

 setTimeout(function() {
     tabdiv.children('#tabs').tabs(select,#tabs-2);

 }, 0);

 Lead me to changing the order of opening the dialog and selecting the
 other tab:

 content.dialog('open');
 tabdiv.children('#tabs').tabs(select,#tabs-2);

 which also works...

 --Klaus

 On 22 Feb., 02:48, mgl mgl@gmail.com wrote:

  Hi all,

  I've found a bug in jQuery 1.3.2 (or maybe Dialog/Tabs in UI 1.6rc6).

  In my application, I have a dialog with tabs inside of it.  I create
  the dialog and build/setup the elements inside it before it is
  displayed to the user.  Up to jQuery 1.3.1 I haven't had a problem
  with this.  Depending on what sequence of actions activates the
  dialog, a different tab will be selected by default, using the .tabs
  ('select',[tabid]) method.  In some cases, this may happen before the
  dialog is displayed - this is where I've found a bug with jQuery
  1.3.2.  Basically, I get two tabs displayed.  Here's an 
  example:http://jsbin.com/umihi/edit

  If there are only two tabs, there's no way to fix it (in the example
  linked above, you can click on the 3rd, and it's okay after that).

  Is there any chance this has something to do with the latest changes
  to the Sizzle library?




[jQuery] Re: adding tabs dynamically

2009-02-20 Thread Klaus Hartl

Why don't you put the desired label in the first place?

$('#tabs').tabs('add', '#new', 'Label');

Other than that you could utilize the add callback:

$('#tabs').tabs({
add: function(event, ui) {
// add additional html to the tab
$('span', ui.tab).html(...);
}
});

Or you can change the tabTemplate option and add that html there...


--Klaus




On 20 Feb., 06:01, Paul Georges sinst...@gmail.com wrote:
 hey guys and gals,

 http://docs.jquery.com/UI/Tabs

 followed the above docs but couldn't quite add tabs correctly yet. i
 can add a tab, yes, but then i can't change it's label or innerHTML.
 how can i do this?

 cheers!

 Paul!


[jQuery] Re: .css('line-height', 'auto') doesnt work

2009-02-19 Thread Klaus Hartl

There is no auto value for line-height. That's normal.

http://www.w3.org/TR/CSS21/visudet.html#propdef-line-height


--Klaus


On 20 Feb., 07:33, Anjanesh anjanesh.for...@gmail.com wrote:
 $('.div  p').css('line-height', '25px'); works but $('.div  p').css
 ('line-height', 'auto'); doesnt.
 Is there anyway to set to auto ?


[jQuery] Re: Guidelines on Graceful Degradation When JavaScript Disabled?

2009-02-16 Thread Klaus Hartl

 Since 'detection' requires javascript, you can't 'detect' if javascript
 is not running.

 What I do is have a p/p or div/div with text like Additional
 features available with javascript enabled. Give it a class with
 display:block and then have javascript change it to display:none.

You should use the noscript element for this. Theoretically CSS could
be disabled but not JavaScript and then users would see the message.

--Klaus


[jQuery] Re: how do I code jquery image gallery inside ajax tabs?

2009-02-16 Thread Klaus Hartl

I can only guess here, but probably both of you have this issue:
http://docs.jquery.com/UI/Tabs#...my_slider.2C_Google_Map.2C_sIFR_etc._not_work_when_placed_in_a_hidden_.28inactive.29_tab.3F

--Klaus


On 17 Feb., 01:29, Talya ta...@studio-taj.com wrote:
 Hi There,

 Im using the jquery cycle plug in with jquery ui tabs.  Both work fine on
 their own but the cycle plugin wont show when I put the html page under one
 of the ui tabs.  

 Talya



 MorningZ wrote:

  Might help others help you if

  1) You specify *which* ajax tabs you are using
  2) some sample of code of what works and what doesn't work

  On Feb 16, 3:57 pm, Arianna ta...@studio-taj.com wrote:
  They both work on their own, but when I click on the ajax tab that
  contains the image gallery html, its just a blank page? What do I need
  to change to get this to work?

  Thanks,
  Arianna

 --
 View this message in 
 context:http://www.nabble.com/how-do-I-code-jquery-image-gallery-inside-ajax-...
 Sent from the jQuery General Discussion mailing list archive at Nabble.com.


[jQuery] Re: Does IE simply not work or...

2009-02-16 Thread Klaus Hartl

Look out for trailing commas in object literals...

{ foo: bar, that: this, }
^

--Klaus


On 16 Feb., 21:58, Dean C. Reed webspee...@gmail.com wrote:
 Or is there a common work around?

 I spent a few days getting familiar with JQuery and it works perfectly  
 in Firefox. I go to test it in IE and literally nothing works. Aside  
 from the basics, I'm using a validator plugin, but I'm getting JS  
 errors at every turn. Vague errors like object expected when I'm  
 simply calling a JS function that uses JQuery calls.

 IE is very frustrating, they should just shoot it and put us out of  
 our misery.

 


[jQuery] Re: checking if there is a select in the form/html?

2009-02-15 Thread Klaus Hartl

The jQuery way:

$('#state').filter('select').doSomething();

--Klaus


On 16 Feb., 00:23, RobG rg...@iinet.net.au wrote:
 On Feb 15, 9:20 pm, angelochen...@gmail.com

 angelochen...@gmail.com wrote:
  Hi Rob,

  Thanks for the quick reply, actually state has a  id='state', I can
  obtain it :

  element = document.getElementById(state);

  and this element can be either an 'input' or a 'select', is there a
  way to determine during runtime?

 if (element.tagName.toLowerCase() == 'select') {
   // it's a select

 }

 --
 Rob


[jQuery] Re: Feature Detection Best Practice?

2009-02-15 Thread Klaus Hartl

On 15 Feb., 20:59, Ricardo Tomasi ricardob...@gmail.com wrote:
 I thought that was the point of $.support - If it doesn't support the
 standard implementation, then it's false.

Probably you're right. I had just a different interpretation... I
would still be confused that this value is false in IE, although if
I'd use fadeIn/fadeOut it'll work.


--Klaus


[jQuery] Re: Feature Detection Best Practice?

2009-02-15 Thread Klaus Hartl

 It's false in IE because it tests for use of the 'opacity' style, not
 whether the browser has opacity support.  Since IE uses filters to
 achieve opacity this results in a false value.  I think it makes sense
 when you think of it that way.

Sure. Although I would have called the property something like
$.support.CSS3Opacity or $.support.W3COpacity etc... I still think
it's confusing.

--Klaus


[jQuery] Re: Feature Detection Best Practice?

2009-02-14 Thread Klaus Hartl


 Are you saying that IE changes its UA string depending on whether
 ClearType is enabled or not?

No.


[jQuery] Re: Feature Detection Best Practice?

2009-02-14 Thread Klaus Hartl



On 14 Feb., 20:31, Chris cpot...@siolon.com wrote:
 On Feb 13, 2:34 am, Klaus Hartl klaus.ha...@googlemail.com wrote:

  That will not avoid IE's ClearType issue, since IE is supporting
  opacity and you still end up in the else branch.

  I think it's one of he rare cases where you need to do browser
  sniffing. I don't think there's a way to find out, if the ClearType
  issue is happening or not.

 It doesn't go in the else branch for IE 6/7 actually. It works as I
 intend. IE 8 however does go in the else branch.

Interesting. I assumed $.support.opacity would be true in IE since it
does support it, even though not as standard CSS3 property.


--Klaus


[jQuery] Re: how to catch mouse click if it is also an onblur event

2009-02-13 Thread Klaus Hartl

Events do fire sequentially. Recommended read:
http://dev.opera.com/articles/view/timing-and-synchronization-in-javascript/

--Klaus


On 13 Feb., 21:54, pantagruel rasmussen.br...@gmail.com wrote:
 Never mind, obviously should just catch the onmousedown.

 On Feb 13, 9:47 pm, pantagruel rasmussen.br...@gmail.com wrote:

  I hope the above is clear. I have an click event that should be
  happening at the same time that a blur event is happening (by clicking
  on a link in a menu I am blurring the input field) which event puts
  the display of the menu to none.

  It seems that when I do this however despite it is the click which
  causes the blur to happen it is the blur that takes precedence. (this
  is in Firefox 3.06)

  My function is the following:

  function losefocus(){
  var currentActiveCommands =  jQuery(#menudiv ul li.runnable).find
  (a.c);
  navigationalTracking.AutoCompletionId = ;
  navigationalTracking.AutoCompletionRow = 0;
  runcommandinputfocused = false;
  currentActiveCommands.each(function(i) {
        $(this).parent().css(display,none);
      });

  }

  If I remove the function on currentActiveCommands I don't have a
  problem catching the click.


[jQuery] Re: Feature Detection Best Practice?

2009-02-12 Thread Klaus Hartl

That will not avoid IE's ClearType issue, since IE is supporting
opacity and you still end up in the else branch.

I think it's one of he rare cases where you need to do browser
sniffing. I don't think there's a way to find out, if the ClearType
issue is happening or not.

--Klaus



On 13 Feb., 04:21, Chris cpot...@siolon.com wrote:
 I ventured into feature detection, and I want to make sure I'm doing
 this the right way. Basically the fx on the jQuery UI tabs causes
 aliasing in IE 6/7 (but not 8). Instead of checking for those browsers
 the old way I thought this is the right way.

         if (!$.support.opacity) {
                 $(.ui-tabs  ul).tabs();
         }
         else {
                 $(.ui-tabs  ul).tabs({
                 fx : {
                         height: 'toggle',
                         opacity: 'toggle'
                 }
                 });
         }


[jQuery] Re: tabs, ajax mode, spinner not removed

2009-02-11 Thread Klaus Hartl

Thanks for this information. I'm about to rewrite this stuff a bit
anyway due to some other bug, and I'll take your findings into
account. Thanks again.

What I really wonder about is, that this code used to work actually.
This is why this whole logic with filtering an images in there... It
surely needs a proper unit test this time!


--Klaus




On 11 Feb., 02:51, brian bally.z...@gmail.com wrote:
 On Tue, Feb 10, 2009 at 4:17 PM, Klaus Hartl klaus.ha...@googlemail.com 
 wrote:

  I've created the ticket aready:
 http://dev.jqueryui.com/ticket/4109

 Thanks, Klaus. I think I've sorted this out, actually. Although I'm
 not certain of a fix.

 I should have been logging this[0].tagName, not
 inner(this)[0].tagName. The answer was staring me right in the face,
 above that cleanup block:

 var inner = function(parent) {
         var $parent = $(parent), $inner = $parent.find('*:last');
         return $inner.length  $inner.is(':not(img)')  $inner || $parent;

 };

 It's the $parent.find('*:last') that's the culprit. Wrapping the img
 in a span does no good because the img, being deepest, will be
 selected every time. Because we don't want the img returned, we'll
 always get $parent--which won't ever be the parent of the IMG because
 that's wrapped in the EM.

 I changed that to:
 $inner = $parent.find('*:not(img):last');

 This works!

 Of course, it fails if I have:
 spinner: 'spanimg src=/css/images/misc/spinner.gif //span'

 ... because the SPAN will be returned by inner() instead of the desired EM.

 So, it seems that there needs to be some other way to get the inner
 element. Maybe the spinner option html fragment needs to be parsed and
 the tags saved in data to better access them later?

 Or, what if, instead of having the EM always, you instead made the
 default to be:
 emloading .../em

 Don't wrap the user-provided HTML fragment inside of an EM and store
 the data in the A instead of the EM. ... and, I'm not sure where I'm
 going with this. I'll have to think about it some.

 Anyway, this seems to be the problem.


[jQuery] Re: tabs, ajax mode, spinner not removed

2009-02-10 Thread Klaus Hartl

Hello Brian, would you mind to file a bug for this?

--Klaus


On 10 Feb., 06:18, brian bally.z...@gmail.com wrote:
 jquery 1.3.1, UI.Tabs 1.6rc6, FF3.0.6

 Whenever any tabs load the spinner img will remain visible. I'm using
 the following for the spinner option for tabs (I've removed everything
 else with the same result)

 spinner: 'img src=/css/images/misc/spinner.gif /'

 The default loading ... does change back to the label text.

 I see that the img should be removed in cleanup(). I can't see any
 reason for it to be failing.

 var cleanup = function() {
         self.$tabs.filter('.ui-tabs-loading').removeClass('ui-tabs-loading')
                         .each(function() {
                                 if (o.spinner)
                                         
 inner(this).parent().html(inner(this).data('label.tabs'));
                         });
         self.xhr = null;

 };

 Taking the 1st tab as an example and using Firebug, when loading has
 completed, the LI has the following classes:

 ui-state-default ui-corner-top ui-tabs-selected ui-state-active

 The anchor has an empty class attribute and the contents are the IMG
 wrapped in an EM.

 There are no errors occurring. Anyone else see this?


[jQuery] Re: tabs, ajax mode, spinner not removed

2009-02-10 Thread Klaus Hartl

As a quick workaround, does the following work:

spinner: 'spanimg src=/css/images/misc/spinner.gif //span'

Or, you could also not touch the default spinner, but add the image as
background-image:

.ui-tabs-load em {
padding-left: 20px;
background: url(/css/images/misc/spinner.gif) no-repeat;
}

Interestingly you're already keeping the image inside the css
folder ;)

Nevertheless, despite the workarounds, I'm going to fix this bug of
course.


--Klaus


On 10 Feb., 19:44, brian bally.z...@gmail.com wrote:
 On Tue, Feb 10, 2009 at 4:21 AM, Klaus Hartl klaus.ha...@googlemail.com 
 wrote:

  Hello Brian, would you mind to file a bug for this?

  --Klaus

 I don't mind at all.In fact, I've found a partial fix. Not really a
 fix, but a lead, anyway. However, I don't see any obvious way to reset
 my forgotten password for Trac. There really should be a link for that
 on the login page.

 I'm referring to the UI Trac site, not the main jquery bugtracker, for
 which I do have my password. I did search Trac before posting, btw,
 and found a similar bug but it's a year old and closed.

 Anyway, I'll leave some info here, for now.

 I altered the cleanup method (line 494) of ui.tabs.js

 var cleanup = function() {
         self.$tabs.filter('.ui-tabs-loading').removeClass('ui-tabs-loading')
                         .each(function() {
                                 if (o.spinner)
                                         
 //inner(this).parent().html(inner(this).data('label.tabs'));
                                         
 inner(this).html(inner(this).find('em').data('label.tabs'));
                         });
         self.xhr = null;

 };

 While the data is stored inside the EM, inner(this) here is actually
 the A tag. The change above causes the spinner to be properly removed
 on tab load.

 But, when I remove the spinner option and let the default text be
 used, inner(this) is then an EM tag and  the loading ... text is not
 removed when a tab loads (with my change in place)

 So, the best I can figure out so far is that the 'ui-tabs-loading'
 class is applied to a different element--A or EM--depending on what's
 inside the tab's A tag. Thus, the filter in cleanup() will return a
 different element. Or something like that. I'm going to pursue that a
 bit more.

 I did wonder if the problem was related to nesting an img inside an
 em, but switching the doctype had no effect.

 If I figure out how to log in to UI Trac I'll post all of this there
 along with anything else I uncover.


[jQuery] Re: tabs, ajax mode, spinner not removed

2009-02-10 Thread Klaus Hartl

I've created the ticket aready:
http://dev.jqueryui.com/ticket/4109


--Klaus


[jQuery] Re: UI/Tabs docs mismatch for multiple ul

2009-02-07 Thread Klaus Hartl


The FAQ applies to UI 1.5.

UI 1.6 requires slightly different markup (additional container) and
works fine for me.

--Klaus


On 6 Feb., 22:32, Nathaniel Whiteinge whitei...@gmail.com wrote:
 The UI Tabs documentation for using ul in a panel [1] has
 conflicting info and I'm not sure how to proceed.

 I'd like the following, but links in the enclosed ul are overwritten
 as though they are tab links::

     ul id=container
         lia href=#oneOne/a/li
         lia href=#twoTwo/a/li
     /ul
     div id=one
         ul.../ul
     /div
     div id=two
         ul.../ul
     /div

 The docs say to select the TOC ul specifically for .tabs() (which
 doesn't work and looks to have been removed in trunk [2]), but also
 say to target #container for tabs(). So how can I prevent tabifying
 links in the subsequent ul elements?

 Thanks.
 - whiteinge

 .. [1]http://docs.jquery.com/UI/Tabs#...the_call_to_tabs_tabify_all_li_elem...
 .. [2]http://dev.jqueryui.com/changeset/2020


[jQuery] Re: UI/Tabs docs mismatch for multiple ul

2009-02-07 Thread Klaus Hartl

 Yes, I'm using 1.5.3 (the current release) and it does not work. Are
 you saying this is not possible with 1.5 and I need to run the preview
 release instead?

No, it's absolutely possible. Otherwise there wouldn't be a FAQ ;-)

If you follow the code example in here it'll should work fine.


--Klaus


[jQuery] Re: $.browser and jQuery 1.3

2009-02-05 Thread Klaus Hartl

 I know it still works in 1.3, just wondering why we are advised not to
 use it.

Because feature detection is much more future proof and stable than
browser sniffing. With browser sniffing you simply make wrong
assumptions.

CSS may be a different beast, although I've never had the need for an
extra style sheet other than IE, which I include with Conditional
Comments.

--Klaus


[jQuery] Re: $('#xxx').html() changing xhtml to html

2009-02-05 Thread Klaus Hartl

You can try as long as you want - as long as you serving XHTML as text/
html, from the browsers point of view (e.g. its parser) it's HTML it's
dealing with, thus it'll remove those slashes internally.

Have you ever wondered why in Firefox' source code view those slashes
are marked red (as in error)? Technically it's still HTML with some
weird slashes where they do not belong. You'd have to serve XHTML as
application/xhtml+xml to change the browser's parser.

That said, you shouldn't waste your time regexing slashes. And instead
go back to HTML 4.01 maybe.

--Klaus



On 5 Feb., 16:03, dantan hattin...@gmail.com wrote:
 I am trying to parse the html out of a specific div to save it with
 php into a SQL-database.

 Working good so far.
 The html is valid xhtml, but html() makes br instead of br / and
 img.. instead of img./

 Is there a workaround to get the xhtml?


[jQuery] Re: How to submit a form with an Anchor rather than an Input tag?

2009-02-04 Thread Klaus Hartl

The name attribute is deprecated for the form element. Using an id ist
good practice.

--Klaus

On 4 Feb., 14:41, Liam Potter radioactiv...@gmail.com wrote:
 why you using get element by id?

 make sure your form has a name ( form name=myform )

 then use this

 a class=button href=javascript://document.myform.submit();Send/a

 ||

 Tintin81 wrote:
  Hi,

  I have a very simple contact form that I would like to submit using an
  anchor rather than an input tag. This is what I've got so far:

  [code]a class=button href=javascript:{}
  onclick=document.getElementById('contact-form').submit(); return
  false;Send/a[/code]

  Unfortunately, it doesn't work :-(

  Can anybody help me with this?

  Thanks a lot...


[jQuery] Re: How to submit a form with an Anchor rather than an Input tag?

2009-02-04 Thread Klaus Hartl

Try something like:

$('#contact-form a').click(function() {
$(this).parents('form').submit();
return false;
});

Or: Simply style a submit input like a link (this is what I would do).

--Klaus


On 4 Feb., 15:38, Tintin81 tkleem...@gmail.com wrote:
 Hi Liam and Klaus,

 thanks for your swift feedback.

 I forgot to say that I am using the a href=http://docs.jquery.com/
 Plugins/ValidationJQuery Validation Plugin/a for this matter.

 The function I am using is rather simple:

 $(document).ready(function() {
                 $(#contact-form).validate();
                 $.extend($.validator.messages, {
                         required: ,
                         email: ,
                 });

 How can I get it to work from an anchor tag in the form??

 Any helo is appeciated...


[jQuery] Re: setting focus to the first empty field

2009-02-04 Thread Klaus Hartl

$('form input[value=]:first').focus();

--Klaus



On 4 Feb., 20:57, Massiverse august.massive...@gmail.com wrote:
 Hello

 I'm a newbie, here's what I need to do (searched the forums first but
 couldn't find the answer).

 1. Search form for an empty input field.
 2. If an empty field exists, set the focus on the field.
 3. If no empty fields exist, do nothing.

 Thanks,

 August


[jQuery] Re: Damn ie7!

2009-02-01 Thread Klaus Hartl

And for some common CSS bugs check: http://positioniseverything.net/

--Klaus


On 1 Feb., 00:31, Karl Swedberg k...@englishrules.com wrote:
 On Jan 30, 2009, at 5:06 PM, david.0pl...@gmail.com wrote:



  Ok, thank you very much i got this!
  Also, just to know is there any site/books that specifically 'speaks'
  about the limitations of the various web browsers?

 Yes, check out PPK's Quirksmode athttp://www.quirksmode.org/

 --Karl
 
 Karl Swedbergwww.englishrules.comwww.learningjquery.com


[jQuery] Re: Guidelines on Graceful Degradation When JavaScript Disabled?

2009-02-01 Thread Klaus Hartl

It's as simple as that: in the first step build a page completely
without JavaScript so that everything works fine. Then add JavaScript/
jQuery to the game and improve the user experience.This concept is
also referred to as Progressive Enhancement. You will find quite some
information about it on the web.

--Klaus



On 1 Feb., 16:31, WebWiz web...@gmail.com wrote:
 I'm new to jQuery so I apologize if this is a dumb question.  I'd like
 to take advantage of the visually interesting things jQuery can do.
 But I'm bumping into a small but significant number of end users who
 either have JavaScript disabled or are running old browsers with bad
 JS support.  Since I want to provide at least a decent experience for
 all site visitors, I'm wondering if there are any guidelines,
 suggestions, or tips on how to build a web page so whatever's being
 done via jQuery still works and looks OK if JavaScript isn't coming
 along for the ride.

 Thanks!


[jQuery] Re: jQuery UI Tabs Flash

2009-02-01 Thread Klaus Hartl

Add the class ui-tabs-hide to your panels beforehand. I will not
encourage bad practice (usage of inline styles).

Note to self: Make FAQ for this.

--Klaus


On 2 Feb., 05:38, Chris cpot...@siolon.com wrote:
 On Jan 12, 9:29 am, tlphipps tra...@brandyandtravis.com wrote:

  This is because of how browsers work.  What's happening is that the
  browser is downloading all the HTML and beginning to display it.  Then
  when the DOM is 'ready', jquery is running the code you've specified
  which creates the tab interface.  To avoid this issue you have to use
  CSS to 'hide' the content that you don't want displayed on page load.

  So if you have 3 tabs, you would use standard CSS to 'hide' (display:
  none) the 2nd and 3rd tabs so the browser would never display them to
  begin with.  Then when the tabs load, jquery takes over showing/hiding
  the content.

 I tried hiding the content, but then it doesn't show. I'm a little
 confused on what's going on.


[jQuery] Re: tabs, ui.panel

2009-02-01 Thread Klaus Hartl

I think I've answered to that question already somewhere else, but
here we go. Yes, ui.panel is a reference to the div DOM node that
contains the content of a tab. You can do with it whatever you want to/
can do with a DOM node, for example wrap it in a jQuery object or
retrieve its id (ui.panel.id).

Other than that I don't understand your question. Could you explain
what kind of information you wish to retrieve from that node?

--Klaus


On 2 Feb., 04:27, pejot pjonar...@gmail.com wrote:
 Hi,

  What is a real meaning of ui.panel object in tabs related events?
  It is HTMLDivElement but how to get some more useful info from that?

 regards,
 Piotr


[jQuery] Re: Does anybody make Sifr work with uitabs?

2009-02-01 Thread Klaus Hartl

http://docs.jquery.com/UI/Tabs#...my_slider.2C_Google_Map.2C_etc._not_work_when_placed_in_a_hidden_.28inactive.29_tab.3F

--Klaus


On 2 Feb., 02:37, slake424 iamtakashii...@googlemail.com wrote:
 Oh my god! Cam Spiers  saved my life. I just added
 position:absolute;left:-1px to the .ui-tabs-hide selector. and
 it's working on the even the next tab. Thanks you so much!

 Thank you.
 Slake424

 On Feb 2, 1:22 am, Cam Spiers camspi...@gmail.com wrote:

  I have got around a similar problem in the past by positioning the element
  off the screen instead of hiding it. I don't know if this is applicable or
  not.

  Cheers,
  Cam

  On Mon, Feb 2, 2009 at 2:16 PM, slake424 
  iamtakashii...@googlemail.comwrote:

   Hello, I have stumbled upon a problem with ui.tabs and Sifr3.  If I
   attempt to use sifr to replace text within a tab, and that tab is
   hidden, the text never gets converted with Sifr. Sifr works on the
   first tab which is visible but when I open the next tab the text that
   supposed to be replaced is not replaced. If anyone success to make
   SIfr works on the hidden tab as well, please let me know what I can
   do.

   Thanks in advance.

   Slake424


[jQuery] Re: Does anybody make Sifr work with uitabs?

2009-02-01 Thread Klaus Hartl

I've added sIFR...:

http://docs.jquery.com/UI/Tabs#...my_slider.2C_Google_Map.2C_sIFR_etc._not_work_when_placed_in_a_hidden_.28inactive.29_tab.3F



On 2 Feb., 08:18, Klaus Hartl klaus.ha...@googlemail.com wrote:
 http://docs.jquery.com/UI/Tabs#...my_slider.2C_Google_Map.2C_etc._not...

 --Klaus

 On 2 Feb., 02:37, slake424 iamtakashii...@googlemail.com wrote:

  Oh my god! Cam Spiers  saved my life. I just added
  position:absolute;left:-1px to the .ui-tabs-hide selector. and
  it's working on the even the next tab. Thanks you so much!

  Thank you.
  Slake424

  On Feb 2, 1:22 am, Cam Spiers camspi...@gmail.com wrote:

   I have got around a similar problem in the past by positioning the element
   off the screen instead of hiding it. I don't know if this is applicable or
   not.

   Cheers,
   Cam

   On Mon, Feb 2, 2009 at 2:16 PM, slake424 
   iamtakashii...@googlemail.comwrote:

Hello, I have stumbled upon a problem with ui.tabs and Sifr3.  If I
attempt to use sifr to replace text within a tab, and that tab is
hidden, the text never gets converted with Sifr. Sifr works on the
first tab which is visible but when I open the next tab the text that
supposed to be replaced is not replaced. If anyone success to make
SIfr works on the hidden tab as well, please let me know what I can
do.

Thanks in advance.

Slake424


[jQuery] Re: jquery tabs ajax mode

2009-01-29 Thread Klaus Hartl

Well, with Tabs 2 you could actually do:

$('#box').tabs({ remote: true });

--Klaus



On 29 Jan., 13:08, jampov jam...@gmail.com wrote:
 I love you stepahn. A million thanks.


[jQuery] Re: How do I show the label text in an input

2009-01-24 Thread Klaus Hartl

I assume you use the for attribute to associate labels with their
inputs. Try (of course you need to adapt the selector probably):

$('label').each(function() {
$('#' + this.htmlFor).val( $(this).text() );
});

--Klaus



osu schrieb:
 Hi,

 Apologies for this noob question, but I really need help and I have
 tried numerous techniques to get this right.

 A client has asked me to create an accessible form that has text
 describing what to put in the input area shown within the input.
 However, they don't want a label above it.

 To keep the form accessible, I've created a class that positions the
 labels in the form -px to the left and used JQuery to add that
 class to the labels so they are visible if Javascript is disabled.

 However, I need to use JQuery to show the label text and place it
 within the input so visitors know what each input is for. I can't just
 add value attribute (i.e. input value = / ) because I'm using this
 for a PHP form variable.

 Can anyone help me with this? I assume it can't be too difficult to
 do...right?

 Thanks


[jQuery] Re: jquery ui tabs 3 problem

2009-01-21 Thread Klaus Hartl

Attach the class to hide a tab panel beforehand:

div id=... class=ui-tabs-hidden.../div

In the future please post jQuery UI related questions to the jQuery UI
mailing list.


--Klaus



On 21 Jan., 18:03, aaron subne...@gmail.com wrote:
 I am using jQuery UI Tabs 3 fromhttp://stilbuero.de/jquery/tabs_3/.
 The problem I have is the delay before the JS loads.  You can see all
 the tabs for a couple of seconds, then they line up.  Is there some
 way to set display:none or some equivalent to hide these even before
 the scripts load?


[jQuery] Re: ui.tabs question

2009-01-21 Thread Klaus Hartl

Seems to be using a fairly outdated version. The event's name to bind
has changed since quite a while. Why not take a look at the
documentation:
http://docs.jquery.com/UI/Tabs#Events

--Klaus



On 21 Jan., 16:36, MorningZ morni...@gmail.com wrote:
 I've got this code working if it helps

 $(#TabContainer ul.tabs).tabs().bind(select.ui-tabs, function(e,
 ui) {
      //Code inside here runs when tab is selected

 });

 On Jan 21, 10:29 am, Alexandre Plennevaux aplennev...@gmail.com
 wrote:

  Hi all,

  I'm using ui.tabs and i would like to trigger a function when a tab is
  clicked, or more precisely, when a new panel gets shown.

  I figured from the doc i should use the select callback but that does
  not work... HEre is the code i use

  var $tabs = $(#tabbedTextContent).tabs({
                                      selected: 0,
                                      fx: { opacity: 'toggle', duration: 200 
  },
                                      select: function(e, ui)
                                      {
                                          alert(hi);  //!-- the
  alert() never gets called
                                          var $img =
  $('#tabbedTextContent div.ui-tabs_panel:visible img.albumImage');
                                          if ($img.length)
                                          {

  $('#imageLegend').text($img.attr('title'));
                                          }
                                      }
                                  });

  So, the tabs are displayed and work correctly, but  the select
  callback (namely, the alert() call) never gets fired...

  Right after that block of code i have

  $('#tabbedTextContent img.albumImage')
                                  .css('cursor', 'pointer')
                                  //.attr('title', Click to view the next 
  image)
                                  .click(function()
                                  { // in image albums, clicking on an
  image brings the user to the next image
                                      var currentTab =
  $tabs.data('selected.tabs');

  $('#imageLegend').text($(this).attr('title'));
                                      var nextTab = (currentTab 
  $tabs.length - 1) ? currentTab + 1 : 0;
                                      $tabs.tabs('select', nextTab);
                                      return false;
                                  });

  which works just fine.


[jQuery] Re: ui.tabs question

2009-01-21 Thread Klaus Hartl

Sorry to hear that, but I was only referring to MorningZ's example,
which contained an outdated syntax and I wanted to prevent you (and
everybody else) to use it and wonder why it wouldn't work.

I'll try to quote better next time.

--Klaus


On 21 Jan., 22:43, Alexandre Plennevaux aplennev...@gmail.com wrote:
 Well, quite Frankly Klaus, i started this project 3 years ago and i
 used the tabs when it was but a plugin like another.
 The fact that now i have to integrate ui.core with ui.tabs is not
 really a good thing in my case: i don't have needs for anything else
 from the ui library, therefore i wish that alongside, there was a
 distro as a standalone plugin.
 I'm using jquery 1.3 so i've made myself a personalised ui distro
 using rc5, but now it breaks the hell out of my app, i don't have tabs
 anymore so here i go, back to the starting point, redoing things that
 were actually working well, but for that one missing callback.

 ah, it's hard to have a reproach to make to jquery. First in 3 years
 in my case, and it's not like i'm mad or anything. Just ... annoyed.

 :)

 On Wed, Jan 21, 2009 at 7:30 PM, Klaus Hartl klaus.ha...@googlemail.com 
 wrote:

  Seems to be using a fairly outdated version. The event's name to bind
  has changed since quite a while. Why not take a look at the
  documentation:
 http://docs.jquery.com/UI/Tabs#Events

  --Klaus

  On 21 Jan., 16:36, MorningZ morni...@gmail.com wrote:
  I've got this code working if it helps

  $(#TabContainer ul.tabs).tabs().bind(select.ui-tabs, function(e,
  ui) {
       //Code inside here runs when tab is selected

  });

  On Jan 21, 10:29 am, Alexandre Plennevaux aplennev...@gmail.com
  wrote:

   Hi all,

   I'm using ui.tabs and i would like to trigger a function when a tab is
   clicked, or more precisely, when a new panel gets shown.

   I figured from the doc i should use the select callback but that does
   not work... HEre is the code i use

   var $tabs = $(#tabbedTextContent).tabs({
                                       selected: 0,
                                       fx: { opacity: 'toggle', duration: 
   200 },
                                       select: function(e, ui)
                                       {
                                           alert(hi);  //!-- the
   alert() never gets called
                                           var $img =
   $('#tabbedTextContent div.ui-tabs_panel:visible img.albumImage');
                                           if ($img.length)
                                           {

   $('#imageLegend').text($img.attr('title'));
                                           }
                                       }
                                   });

   So, the tabs are displayed and work correctly, but  the select
   callback (namely, the alert() call) never gets fired...

   Right after that block of code i have

   $('#tabbedTextContent img.albumImage')
                                   .css('cursor', 'pointer')
                                   //.attr('title', Click to view the next 
   image)
                                   .click(function()
                                   { // in image albums, clicking on an
   image brings the user to the next image
                                       var currentTab =
   $tabs.data('selected.tabs');

   $('#imageLegend').text($(this).attr('title'));
                                       var nextTab = (currentTab 
   $tabs.length - 1) ? currentTab + 1 : 0;
                                       $tabs.tabs('select', nextTab);
                                       return false;
                                   });

   which works just fine.


[jQuery] Re: Documentation on comparative operators?

2009-01-20 Thread Klaus Hartl

On 20 Jan., 20:06, MorningZ morni...@gmail.com wrote:
 but just comparing value a to value b, it doesn't get any easier/
 better than JavaScript's native == operator

Not so fast. Be aware that the equality operator may give you
unexpected results because of type conversion, example:

0 == '' // = true
0 == false // = true

Thus there may be cases to use strict equality:

0 === '' // = false
0 === false // = false

--Klaus






[jQuery] Re: Solution To Many Of Your CSS Nightmares!

2009-01-20 Thread Klaus Hartl

On the other hand - I've seen much worse offtopic threads here. And
yes, I've been annoyed by them. That said, sorry for putting fuel into
the discussion.

--Klaus


On 21 Jan., 05:25, Karl Swedberg k...@englishrules.com wrote:
 On Jan 20, 2009, at 10:31 PM, johny why wrote:



  what does this have to do with jQuery?

      --this topic is on the jquery forum, because problems with a
  jQuery component, Superfish,  caused me to devise this method.

 Yes, but this thread has long since moved far, far away from any  
 discussion of the Superfish plugin. This has been a CSS discussion. I  
 second Mike's request for you to continue it in a more appropriate  
 forum.

 Thanks,

 --Karl

 
 Karl Swedbergwww.englishrules.comwww.learningjquery.com


[jQuery] Re: Problems with finding parental a-tag

2009-01-19 Thread Klaus Hartl

First of all, you need to fix your HTML. An anchor is an inline
element and may not contain div, p etc. This may give you unexpected
results cross-browser and scripting on top of an invalid DOM is not a
good idea to begin with.

--Klaus


On 19 Jan., 12:11, Christoph Neymeyr christ...@uddebo.net wrote:
 Hi,

 I have a situation where I have an image with a specific class. I need
 to find the a-tags surrounding this items class, but could not make
 is, as I have different situations that are totally dynamic -
 unfortunately.

 a href=...divdivdivpimg class=thisClass/p/div/
 div/div/a

 and

 a href=...bimg class=thisClassbrcaption/b/a

 Anybody knows of a good idea on how to select the surrounding a-tags
 of all items with class=thisClass?

 Thanks a lot - this made me headache...

 Christoph, using 1.2.6


[jQuery] Re: Solution To Many Of Your CSS Nightmares!

2009-01-18 Thread Klaus Hartl



On 18 Jan., 19:16, Ricardo Tomasi ricardob...@gmail.com wrote:
 They're named **Cascading** Style Sheets for a reason. Third party
 CSS Candy that is supposed to be inserted in other's pages should be
 coded with this issue in mind, protecting all it's styles in it's own
 container, or writing styles in-line (if it's not meant to be
 altered). If this has not been done it is indeed badly written code.

Inline styles are not a guarantee that a websites CSS would not
cascade into that widget. Although inline styles have highest
specificity, declarations with !important will still override those
inline styles. They do not in IE but that is a different story.

 I realize you're not aware of the issues that arise from your
 solution. There is also a reason why !important is seldomly used:
 because it makes a mess of figuring out which style is being applied
 by overriding the cascading - eased by the use of firebug inspection
 or similar of course, but a mess nonetheless.

I tend to agree. When I do write CSS I almost always try to avoid !
important and consider it bad practice. Most of the time it turned
out to cause you more problems than do any good.

I think the solution for a 3rd party widget though should be to use a
unique identifier plus important declarations to 1. protect messing up
the site's CSS where it's included in while 2. at the same time
maintaining its own styles.

Nevertheless there is no guarantee that the site's CSS will not
override styles unless you use an iframe or object element to include
that widget.


--Klaus


[jQuery] Re: Solution To Many Of Your CSS Nightmares!

2009-01-18 Thread Klaus Hartl

On 18 Jan., 21:45, johny why johny...@gmail.com wrote:
 a 3rd party widget...should...use...important declarations.
 Nevertheless there is no guarantee that the site's CSS will not
 override styles.
 --why? unless the site css ALSO uses !important, how else could it
 override the candy-css?

Yes, that's exactly it. You obviously cannot prevent a site author to
use !important as well and thus all I was saying is that - especially
from the standpoint of the 3rd party developer - there is no guarantee
the 3rd party's CSS will not be overridden unless an iframe is used
for such widget.

Yet another reason to avoid !important for your site - at least if you
know you want to include 3rd party stuff.

--Klaus




[jQuery] Re: Solution To Many Of Your CSS Nightmares!

2009-01-17 Thread Klaus Hartl

One thing to keep in mind: If two declarations use !important! the
conflict is solved by specificity again, e.g. as if there were no !
important:

div id=foo class=bar

#foo {
width: 200px !important; /* higher specificity */
}
.bar {
width: 300px !important;
}

Applied width will be 200px.


--Klaus


On 17 Jan., 06:31, johny why johny...@gmail.com wrote:
 trying to integrate a 3rd party css candy into your site may result in
 conflicts between the candy's css and your site's css, resulting in a
 rendering mess. stuff that works beautifully by itself blows up when
 you put it into your website. this trick may not find you a new
 girlfriend, or butter your bread on both sides, !BUT¡  it may
 instantly eliminate your css conflicts. it instantly eliminated ALL of
 the rendering conflicts i was having with superfish (and other css
 menus), when trying to integrate them into my site.

 SOLUTION:
 open all your css files, and globally replace: ; with  !important;

 THAT'S IT!

 (don't forget the space before !important;)

 for example, this:

 top: -999em;

 will become:

 top: -999em !important;

 HOW IT WORKS:
 the !important property forces that style to override all other css,
 whether style-sheets, inline-css, header-styles, and whether above or
 below in the css hierarchy.

 badabing!

 http://users.tpg.com.au/j_birch/plugins/superfish/http://inyourear.org


[jQuery] Re: UI Tabs bug

2009-01-15 Thread Klaus Hartl

Could you please file a ticket... thanks.

--Klaus


On 16 Jan., 06:13, brian bally.z...@gmail.com wrote:
 sorry,

 jQuery 1.2.6
 UI 1.6rc4

 On Thu, Jan 15, 2009 at 10:49 PM, brian bally.z...@gmail.com wrote:
  synopsis: UI.tabs faisl hard when there is no UL for which to apply tabs.

  I have an admin section for which I'm using a tabbed nav bar. But, in
  a few pages, the UL does not appear (by design). Because I have this
  line in my admin.js:

  $('#nav_admin').tabs({ ... });

  ... jQuery is coming to a screeching halt with this error:

  -- snip --
  Error: c has no properties
  Source file:http://cake_elan.apollo/js/lib/jquery-1.2.6.js
  Line: 662
  -- snip --

  I traced it to this line in _tabify()

  $.data(a, 'load.tabs', a.href);

  To fix, I needed to wrap that block in my admin.js with:

  if ($('#nav_admin ul').length) { ... }

  Solution: UI.tabs needs to fail gracefully when there is no UL
  available to apply tabs to.


[jQuery] Re: jQuery UI tabs widget problem

2009-01-11 Thread Klaus Hartl

Again, everything works as expected for me. Could you possibly put up
a test case?

Also, could you try and update to latest version from the repository?
It may be related to a bug that occured when initializing a div
instead of a ul element.

BTW, in your first example you need to use the data method:

jQuery('#product').data(disabled.tabs, [1,2,3,4]);


--Klaus


On 12 Jan., 00:03, Jesse jesse.bad...@gmail.com wrote:
 I would like to confirm that the array methods for disabling tabs does
 not work.

 I have 1.6rc4 installed.  5 Tabs 4 of which I need disabled on page
 load

                 jQuery('#product').tabs();
                 jQuery('#product').tabs(disabled.tabs, [1,2,3,4]);

 does not work.. neither does

                 jQuery('#product').tabs({ disabled: [1,2,3,4] });

 However this does work

                 jQuery('#product').tabs();
                 jQuery('#product').tabs(disable, 1);
                 jQuery('#product').tabs(disable, 2);
                 jQuery('#product').tabs(disable, 3);
                 jQuery('#product').tabs(disable, 4);

 J

 On Jan 10, 4:25 am, Klaus Hartl klaus.ha...@googlemail.com wrote:

  $(#tabs).data('disabled.tabs', [1,2]) as well as $(#tabs).tabs
  ({ disabled: [1,2] }) both do work fine for me.

  --Klaus

  On 9 Jan., 12:47, tesdev tesde...@googlemail.com wrote:

   Using jquery.ui-1.6rc4\jquery.ui-1.6rc4\demos\tabs\default.html as a
   base
   Getting there... ui-state-disabled is assigned but...
   line 11 ...
           $(function() {
                   $(#tabs).tabs();
                   // tried 3disablevariations from different sources
                   //$(#tabs).data('disabled.tabs', [1,2]);
                   $(#tabs).tabs(disable, 1);  //works
                   $(#tabs).tabs(disable, 2); //works
                   //$(#tabs).tabs({disabled: [1,2]});
           });
   The array versions dont work - should they in this context?
   Danny

   On Dec 31 2008, 5:26 pm, Klaus Hartl klaus.ha...@googlemail.com
   wrote:

No suggestions unless you show us some code...

--Klaus

On 31 Dez., 08:11, JasonR jbra...@yahoo.com wrote:

 Hello,
 I have some content and am using thetabswidget to reload without
 refreshing. Everything is working fine except for one problem...the 
 ui-
tabs-disabled class is not being assigned to any of thetabs.
 Whichever tab I click is assigned the ui-tabs-selected class, and the
 tab adopts the styles for that class. But my styles for the disabled
tabsare not showing up. Checking in Firebug I can verify that the
 class is not being assigned.

 Any suggestions? Thanks.


[jQuery] Re: is accessing element by a class faster than accessing X element by ID

2009-01-05 Thread Klaus Hartl

In any event, using the element's type together with a class selector
will improve performance (otherwise every single element in the
current context is checked for that class):

$('div.toto').hide();

With a single element (or very few) using an id will probably be
faster, but with 50+ elements, it might be faster to optimize the
query instead and use a class plus context...:

$('div.toto', '#container').hide();

or even, depending on the markup:

$(' div.toto', '#container').hide();

(#container would be a div that contains all divs that belong to the
class toto).

But maybe that still wouldn't beat getElementById. Instead of us
speculating here, you should simply test performance with FireBug
yourself and see what works best:

console.time('first');
$(div[id^='toto']).hide();
console.timeEnd('first');

console.time('second');
$('div.toto').hide();
console.timeEnd('second');

and so on...

Depending on how you can adapt markup another option to improve
performance would be to skip classes at all and just use context:

div id=toto
div/div
div/div
...
/div

$('#toto div').hide();

Again, you'd need to verify what's the fastest.


--Klaus



On 5 Jan., 16:50, Christof Donat cdo...@gmx.de wrote:
 Hi,

  And try something like:

  var toto = [];
  $('.toto').each(function(){
      var elem = $(this);
      toto[elem.attr('ref')] = elem;
  }

  Then, to hide the toto div with ref=1 or ref=2, just call:

  toto[1].hide(); toto[2].hide();

 Why not use this:

 var toto = $('.toto');
 toto[1].hide(); toto[2].hide();

 That should be the same.

 Appart from that I think, that Jean Babtiste wanted to hide all elements at
 the same time. I'd expect his first ( $('.toto').hide() ) version to be
 usually faster, but I'm not shure about that.

 Christof


[jQuery] Re: How to set the HTML background

2009-01-02 Thread Klaus Hartl

That's not true. You can set the html element's background...

html {
background: yellow;
}

The reason it doesn't work here is that there is no document.html
property. You either can reference the element via
document.documentElement or just via html selector:

$(html).css(background, yellow);


--Klaus


On 2 Jan., 17:16, Andy Matthews li...@commadelimited.com wrote:
 That's because you can't set the background color of the HTML tag. It
 doesn't have that attribute. Even if you could do that, one would override
 the other.

 What you probably want to do is to set the bg of the body tag, then set the
 bg of a container INSIDE the body like so:

 body
         div/div
 /body

 -Original Message-
 From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On

 Behalf Of BlueStunt
 Sent: Friday, January 02, 2009 9:29 AM
 To: jquery-en@googlegroups.com
 Subject: [jQuery] How to set the HTML background

 I want to be able to change the background of the page,

 I can successfully do

 $(document.body).css(background, yellow);

 but I have two separate css backgrounds, one sets the body tag and one sets
 the html tag.

 So how do I set the html tags background

 I've tried

 $(document.html).css(background, yellow);

 but it won't work :/
 --
 View this message in 
 context:http://www.nabble.com/How-to-set-the-HTML-background-tp21252706s27240...
 06.html
 Sent from the jQuery General Discussion mailing list archive at Nabble.com.


[jQuery] Re: Jquery Tabs issue, linking to another tab from within the same document...

2008-12-31 Thread Klaus Hartl

I assume you're using UI Tabs...

http://docs.jquery.com/UI/Tabs#...select_a_tab_from_a_text_link_instead_of_clicking_a_tab_itself

--Klaus


On 30 Dez., 19:09, Ted theodorew...@gmail.com wrote:
 I'm having a problem with Jquery's tab plugin.

 Specifically, I've got a page with a couple of tabs. On that page, in
 one of the tabs, is a link to another tab. However, the link doesn't
 work. Additionally, I've noticed that on my main navigation, if I'm on
 the page with multiple tabs, and I click a link to a specific tab, it
 will not load.

 For example:

 The page is page.html. With in that page are 3 tabs, #tab1, #tab2, and
 #tab3.

 If within the div for #tab1 I want to link to #tab3 by using a
 href=#tab3, it doesn't work.

 Additionally, if I'm on page.html, and I want to load #tab3 by
 clicking on the main navigation that has page.html#tab3 as the link,
 it doesn't work.

 Anyone know of a fix for this?

 Thanks,
 Ted


[jQuery] Re: jQuery UI tabs widget problem

2008-12-31 Thread Klaus Hartl

No suggestions unless you show us some code...

--Klaus


On 31 Dez., 08:11, JasonR jbra...@yahoo.com wrote:
 Hello,
 I have some content and am using the tabs widget to reload without
 refreshing. Everything is working fine except for one problem...the ui-
 tabs-disabled class is not being assigned to any of the tabs.
 Whichever tab I click is assigned the ui-tabs-selected class, and the
 tab adopts the styles for that class. But my styles for the disabled
 tabs are not showing up. Checking in Firebug I can verify that the
 class is not being assigned.

 Any suggestions? Thanks.


[jQuery] Re: UI tabs problem - ui-tabs-disabled class not being assigned

2008-12-31 Thread Klaus Hartl

The disabled class is not supposed to be assigned to all but the
selected tab. Where did you get that information from? It is only
assigned to tabs that either are disabled via option

$(...).tabs({ disabled: [1, 2]});

or if a single tab is manually disabled:

$(...).tabs('disable', 1);

There is a difference between disabled and unselected.

--Klaus


On 31 Dez., 09:26, JasonR jbra...@yahoo.com wrote:
 The class ui-tabs-disabled is supposed to be assigned to all but the
 selected tab, but it is not working for me. The selected tab is
 working great, and when I select tabs it reassigns the ui-tabs-
 selected class, so I know everything is set up correctly. Anybody have
 any ideas why the ui-tabs-disabled class is not getting assigned?
 Thanks.


[jQuery] Re: HELP: Screening questions for JavaScript developer candidates:

2008-12-30 Thread Klaus Hartl

On 30 Dez., 08:45, Alexandre Plennevaux aplennev...@gmail.com
wrote:
 JavaScript enclosures?

 i think it has to do with encapsulating your code inside a function so
 that all vars are inside the function's scope, so not cluttering the
 global namespace.
 This, to avoid memory leak.

Are you implying that global variables do leak memory? There are good
reasons to not clutter the global namespace but I don't believe
avoiding leaks is one of them.

Actually you do increase the chance to create leaks in IE if you use
closures under certain circumstances.

--Klaus


[jQuery] Re: Selecting disparate elements in unobtrusive javascript without parameters?

2008-12-27 Thread Klaus Hartl

  That would work fine, but it involves parsing the ID for a name
  component that is common to the link and the DIV.

 Yes, indeed, that is exactly what you would do. But it's so simple - it
 takes less code to do it than describe it. For example:

     $(function() {
         $('#left a').click( function() {
             $( '#' + this.id.replace( '_link', '_div' ) ).doSomething();
         });
     });

 Or another way to do the same thing:

     $(function() {
         $('#left a').click( function() {
             $( '#' + this.id.split('_')[0] + '_div' ).doSomething();
         });
     });

 Or if you have several related elements to operate on:

     $(function() {
         $('#left a').click( function() {
             var base = '#' + this.id.replace( '_link', '_' );
             $( base + 'div' ).doSomething();
             $( base + 'navlink' ).doSomethingElse();
             $( base + 'whatever' ).doWhatever();
         });
     });

 What's not to like?

One thing I can think of is that you need to rely on the id's being in
a certain format, e.g you're creating a dependency of client-side and
PHP code. (Re-)using the hash makes it agnostic of the format of the
id.

--Klaus


[jQuery] Re: Selecting disparate elements in unobtrusive javascript without parameters?

2008-12-26 Thread Klaus Hartl

You said you don't want to litter your code with bogus classes, but -
speaking of unobtrusive - you do litter it with bogus anchors
(href=#). That said, the most obvious solution to me is to give
these anchors a little more meaning by letting them point to the div
they seem to be connected to anyway:

a href=#m1_divModule 1/a

Such semantically improved HTML will also make your scripting easier
(and theoretically - even if it may be not too much of a concern in a
CMS, it will degrade more gracefully).

In your jQuery code you can then easily rely on the hash property to
access the associated elements, thus you get a pretty generic,
straightforward solution:

$('a').click(function() {
var fragment = $(this.hash); // a div in our case
// do something with fragment, for instance toggle
// so something else
});

--Klaus



On 26 Dez., 17:47, spud s...@dadatypo.com wrote:
 This question is partially about unobtrusive javascript in general,
 but with specific reference to jQuery syntax. I am a long-time
 javascript programmer, but a total jQuery noob.

 I am attempting to use jQuery to replace onclick handlers that were
 previously generated inline as part of a CMS. Most of the tutorials
 I've seen for things like collapsable menus achieve their generic
 effect by referring to object relationships via their position in the
 DOM. E.g.

 $(img.disclosure).parent().next().hide();

 so if you assign that to a click handler, it will hide the next
 sibling of the parent container of the image. That makes the code
 pretty generic...it doesn't care how many elements there are, nor
 where they are on the page, as long as the location relationship
 between the image and the thing-to-hide is parent().next().

 My question, however, is about relationships between elements that
 might be scattered all over the page. Imagine a two-column page, with
 a #left sidebar column and a #main column of content. In the #left
 column, some PHP code loops through data results, and spits out a
 series of links:

 a id=m1_link href=#Module 1/a
 a id=m2_link href=#Module 2/a
 a id=m9_link href=#Module 9/a
 a id=mN_link href=#Module N/a

 The number of results could change, and their identifiers are not
 necessarily sequential numbers.

 Next, the main column spits out a series of DIVs from a similar data
 set:

 div id=m1_divm1 content.../div
 div id=m2_divm2 content.../div
 div id=m9_divm9 content.../div
 div id=mN_divmN content.../div

 I want to make it so that when a user clicks on m1_link, it toggles
 the display of m1_div. There may be a ton of HTML in between the two
 groups of output, so I cannot accomplish my tasks with references like
 parent() or next().

 I had been creating my onclick handlers inline during the output
 generation, by simply adding (in pseudo-code)

 onclick=toggleDisplay('m_[identifier]_div')

 to each of the links, where [identifier] was unique to each iteration.
 Since I was looping through the data set, I could pass the name of the
 appropriate DIV as a parameter to the toggleDisplay() function.

 Writing unobtrusive javascript, however, means giving up that
 flexibility to pass parameters, so it is not clear to me how to make
 jQuery understand that there is a relationship between m1_link and
 m1_div.

 The only solution apparent to me is to
 1. grab the links and assign a click function to them
 2. have the click function get the ID of the link, e.g. m1_link
 3. extract the base name from the ID, e.g. m1_link.replace
 (_link,) = m1
 4. append _div to the base name and use m1_div to select the
 appropriate DIV

 That would work fine, but it involves parsing the ID for a name
 component that is common to the link and the DIV.

 Is there no more efficient way to accomplish the same thing? The same
 issue could be even more complex, for example, clicking on one of the
 links would

 a. toggle display of the appropriate DIV
 b. alter the SRC attribute of an image at the top of the page
 c. add a background color to the appropriate section of a navigation
 menu

 The one thing I want to avoid is adding a class for each different
 base name, so solutions like class=m1 won't help. I refuse to litter
 my code with bogus classes.

 I'm really just wondering if there's a more obvious solution that I'm
 missing. Any suggestions?


  1   2   3   4   5   6   7   8   9   >