Re: [jQuery] How to make input readonly with jQuery in IE

2006-10-18 Thread Jörn Zaefferer
Klaus Hartl schrieb:
>> But I really wanted readonly. This didn't work:
>> $("span.readonly input").attr("readonly", true);
>>  
>> But these did. Note the camelCase:
>> $("span.readonly input").attr("readOnly", true);
>>
>>  
>> $("span.readonly input").each(function() {
>> this.readOnly = true;
>> });
>> 
>
> I think that is one for the attributes fix list?
>   
ie: readonly: "readOnly"?

-- Jörn

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


[jQuery] jQuery Kinda Plugin: every

2006-10-18 Thread Blair Mitchelmore
I don't know if this exists already but I needed this and assumed it 
didn't and wrote it myself. Essentially it lets you do something to an 
element every given time interval.

jQuery.fn.every = function(interval,fn) {
return this.each(function() {
var self = this;
window.setInterval(function() { fn.call(self) },interval);
});
};

I used it to get a millisecond amount display every so often to produce 
a live updated element. It's mostly for live clock updating (and I 
suppose it could be useful to implement polling) but I'm sure the 
creative among you could find some other purpose for it.

Example:
// Display the current time updated every 500 ms
$("p.display").every(500,function() {
$(this).html(new Date());
});

-blair

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] jQuery history plugin - from making the back button work to a more elaborate Hijax solution

2006-10-18 Thread Klaus Hartl

Paul Bakaus schrieb:
> Hi Klaus,
> 
> your idea is definitely worth trying out, sounds great to me!
> By the way, I've found some (maybe?) bug in your current history 
> implementation. If you initalize the page for the first time, then click 
> a link, and then click the back button again, it will show you chapter 3 
> instead of no chapters. Have you noticed the same?

Hi Paul,

yes, this is also related to my statement:

"Also todo is to automatically show the
appropriate part, if the hash in the url refers to some point in the
history but I can borrow that from the tabs plugin as well."

That wasn't expressed to clearly. But its actually the same bug, the 
initial page state has to be remembered, as well as the approbiate link 
has to be loaded if there's an hash in the url.


Thanks for the feedback.


-- Klaus

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] How to make input readonly with jQuery in IE

2006-10-18 Thread Klaus Hartl

> But I really wanted readonly. This didn't work:
> $("span.readonly input").attr("readonly", true);
>  
> But these did. Note the camelCase:
> $("span.readonly input").attr("readOnly", true);
> 
>  
> $("span.readonly input").each(function() {
> this.readOnly = true;
> });

I think that is one for the attributes fix list?


-- Klaus

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Please help (again, sorry)..NextUntil not working

2006-10-18 Thread Klaus Hartl
Greg Bird schrieb:
> You must live and breath this stuff.

Hey Greg, indeed!

Klaus


PS: John is the creator of the wonderful jQuery library... ;)





___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] jQuery history plugin - from making the back button work to a more elaborate Hijax solution

2006-10-18 Thread Paul Bakaus
Hi Klaus,your idea is definitely worth trying out, sounds great to me!By the way, I've found some (maybe?) bug in your current history implementation. If you initalize the page for the first time, then click a link, and then click the back button again, it will show you chapter 3 instead of no chapters. Have you noticed the same?
2006/10/19, Klaus Hartl <[EMAIL PROTECTED]>:
Hi jQuerians,people demanded, so I started to extract the history functionality fromthe tabs plugin to make a standalone plugin out of it.Worked out so far:
http://stilbuero.de/jquery/history/http://stilbuero.de/jquery/tabs/It's still alpha, support for Firefox, Safari and Opera is there, IE notyet but will be added. Also todo is to automatically show the
appropriate part, if the hash in the url refers to some point in thehistory but I can borrow that from the tabs plugin as well.At the moment it works by hooking into links and adding an eventhandler, like (prototypical code, setHash is required by Safari):
$('a').click(function(e) { $.history.setHash('#' + this.href.split('#')[1], e);});That's ok for me, I think its important to be able to control whichlinks should be "observed" anyway. So the snippet above might become
$('a.hijax').history();withjQuery.fn.history = function() { return this.each(function() { $(this).click(function(e) { jQuery.history.setHash('#' + this.href.split
('#')[1]); }); });};Or maybe it is reasonable to use a custom event? I'd like that:$('a.hijax').bind('history', function() {...}).click(function() { $(this).trigger('history');
});Does that work?But:You all know, I'm all for unobtrusive JS and the concept of progressiveenhancement. I don't like having a link in my HTML like href="" which actually points nowhere with JS disabled.
Why not implement a better solution for being able to implement Hijaxthe easy way (like what the form module is already offering)?So the links stay as they are and point to an existing ressource:Then I intercept all these links, change the href value to hashes andload on click the content from the URL of the initial href value viaXHR. Links that already have a hash in their URL won't load via XHR but
add to history (that is needed to stay compatible with tabs).That would 1. result in history support (in most browsers) and 2. in anice gracefully degrading application with JS disabled or for browsers
not supported by jQuery. Totally unobtrusive.That concept would of course involve the back-end as well. There it mustbe decided upon the "X-Requested-With" request header what to send back(whole page or only the part of the page that needs to be updated.
What do you guys think? Feedback and ideas welcome...-- Klaus___jQuery mailing list
discuss@jquery.comhttp://jquery.com/discuss/-- Paul BakausWeb DeveloperHildastr. 35
79102 Freiburg
___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] How to safely get the clickTarget of an event?

2006-10-18 Thread Klaus Hartl


Kurt Mackey schrieb:
> Is there a “jQuery” way of getting an event’s click target?  I tend to 
> use those elements quite a bit, but getting them is a pain. J

Hi Kurt,

jQuery provides no functionality to retrieve the target. Here's my way 
to do that:


$( ... ).click(function(e) {
 var ev = e || event;
 var target = ev.target || ev.srcElement;
 $(target).css('border', '1px solid red');
});

Maybe that should be abstracted by jQuery...


-- Klaus

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Popup window reference problem

2006-10-18 Thread Jacky
So, I should:
1. includes jQuery library in popup.
2. call ref.$()
where ref is the window reference created in window.open?

On 10/19/06, Blair McKenzie <[EMAIL PROTECTED]> wrote:
> The only way I know of to use jQuery in another window/frame is to include
> jquery in that page's html, and then access it using window.$().
>
> Blair
>
>
> On 10/19/06, Jacky <[EMAIL PROTECTED]> wrote:
> >
> > I have tried to directly use the window reference.
> > i.e.
> > var abc = ref.document.getElementById("abc1");
> > abc.parentNode.removeChild(abc);
> >
> > The result is correct that the input box in popup windows being removed.
> > Seems that jQuery cannot use popup window reference?
> >
> > On 10/17/06, Jacky <[EMAIL PROTECTED]> wrote:
> > > Dear all,
> > >
> > > I would like to make a simple popup which would copy current page
> > > content and do some conversion ( e.g. text box to text). But I have met
> > > a problem of getting a wrong reference. Here is the code to
> > > demonstrate the problem:
> > >
> > > 
> > > 
> > > Test Popup
> > > 
> > > 
> > > $(document).ready(function(){
> > >
> $("#popup").click(specificPop);
> > >
> > > function specificPop(){
> > > var ref =
> genericPopup();
> > >
> $(ref.document).find("#popup_body #abc1").remove();
> > > }
> > >
> > > function
> genericPopup(){
> > > var ref =
> window.open('','','resizable=1,width=400,height=400');
> > > var diva =
> $("#diva").clone();
> > >
> ref.document.open();
> > >
> ref.document.write('Popup');
> > >
> ref.document.write ('');
> > >
> ref.document.write($(diva).html());
> > >
> ref.document.write('');
> > >
> ref.document.close();
> > > return ref;
> > > }
> > > });
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > popup
> > > 
> > > 
> > >
> > > In this example, I would expect the text box #abc1 in the popup is
> > > removed. But it removes current window's one instead. For the removal
> > > code, I have tried the following approaches:
> > >
> > > $(ref.document).find("#abc1").remove();
> > > $(ref.document).find("#popup_body #abc1").remove();
> > > $("#popup_body #abc1",ref.document).remove();
> > > $(ref.document ).find("#popup_body #abc1",ref.document).remove();
> > >
> > > but all failed. Any idea how can I can the correct reference??
> > >
> > > P.S. using jQ ver 1.0.2
> > > --
> > > Best Regards,
> > > Jacky
> > > http://jacky.seezone.net
> > >
> >
> >
> >
> > --
> > Best Regards,
> > Jacky
> > 網絡暴民 http://jacky.seezone.net
> >
> > ___
> > jQuery mailing list
> > discuss@jquery.com
> > http://jquery.com/discuss/
> >
>
>
> ___
> jQuery mailing list
> discuss@jquery.com
> http://jquery.com/discuss/
>
>
>


-- 
Best Regards,
Jacky
網絡暴民 http://jacky.seezone.net

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] fundamentals: .index(obj) or better solution

2006-10-18 Thread Michael Crowl

John -

Thank you, that worked!  Part of what confused me was that index() is 
defined as having an Obj as the argument, but not what kind - my 
attempts at using an expression as an argument were failing, so I was 
running out of ideas.  I wasn't following context properly.

Have enjoyed working with jQuery lately, nice update.

-- mike


John Resig wrote:
> .index() doesn't do what you think it does. It works like this:
>
> // Find the position of the P that an ID of someP /within/ the list of
> p elements.
> $("p").index( $("#someP")[0] )
>
> So, in your code it would be something like this:
>
> // div i want to find
> id = 3;
>
> // get the element i want to move
> var curr_obj = $("[EMAIL PROTECTED]'id[]'[EMAIL 
> PROTECTED]'"+id+"']").parent()[0];
>
> // determine its current location within the set of list_items
> var old_pos = $("div.list_item").index(curr_obj);
>
> So two things to note: .get() returns an array of elements, not just a
> single element and  .index() works over a list of elements, not the
> children of an element. I hope this makes sense, it is something of
> confusing method. I plan on polishing it up some, as it was a late
> addition to 1.0.
>
> --John
>
> On 10/17/06, Michael Crowl <[EMAIL PROTECTED]> wrote:
>   
>> .index() is driving me nuts, and I'm trying to figure out if there's an
>> obvious solution to what I'm trying to do, or if I'm missing something
>> in the API.
>>
>> Let's say I have the following:
>>
>> 
>>
>> 
>> 
>> // interface
>> 
>>
>> 
>> 
>> // interface
>> 
>>
>> 
>> 
>> // interface
>> 
>>
>> 
>> 
>> // interface
>> 
>>
>> 
>>
>> How do I determine the current element position of a particular
>> list_item in that container, using jQuery?
>>
>> Using .index(), it seems like this should work:
>>
>> // div i want to find
>> id = 3;
>> // get the element i want to move
>> var curr_obj = $("[EMAIL PROTECTED]'id[]'[EMAIL 
>> PROTECTED]'"+id+"']").parent().get();
>> // determine its current location within the set of list_items
>> var old_pos = $("#list").index(curr_obj);
>>
>> ...or a number of other combinations I've tried, and none of them can
>> get anything but -1 from .index().
>>
>> What am I doing wrong here?
>> - Does .get() really return an element object?  (It seems to.)
>> - What kind of object is .index() looking for?
>> 
>
> ___
> jQuery mailing list
> discuss@jquery.com
> http://jquery.com/discuss/
>
>   


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


[jQuery] Tablesorter

2006-10-18 Thread Yehuda Katz
I have a need to have the tablesorter do the following:1) Refresh when I need it to (I'm going to be doing DOM insertions, and will need to refresh the table after an insertion). The best thing I could think of thus far is $(".sortUp, .sortDown").click().click(). Obviously not the best idea.
2) Use custom sorters. I see that the table sorter SUPPORTS custom sorters and parsers, but I wasn't sure about the best way to do this.Christian? Anyone?-- Yehuda KatzWeb Developer | Wycats Designs
(ph)  718.877.1325
___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Popup window reference problem

2006-10-18 Thread Blair McKenzie
The only way I know of to use jQuery in another window/frame is to include jquery in that page's html, and then access it using window.$().BlairOn 10/19/06, 
Jacky <[EMAIL PROTECTED]> wrote:I have tried to directly use the window reference.
i.e.var abc = ref.document.getElementById("abc1");abc.parentNode.removeChild(abc);The result is correct that the input box in popup windows being removed.Seems that jQuery cannot use popup window reference?
On 10/17/06, Jacky <[EMAIL PROTECTED]> wrote:> Dear all,>> I would like to make a simple popup which would copy current page> content and do some conversion (
e.g. text box to text). But I have met> a problem of getting a wrong reference. Here is the code to> demonstrate the problem:>> > > Test Popup
> >