Re: [jQuery] Of extendos, metadata and valid XHMTL - Is it ok to add attributes to elements?
Daemach schrieb: Your faith in Microsoft is certainly admirable, but the very fact that we're talking about storing 2 kinds of information in a single attribute is cause for concern isn't it? Thinking about the way parsers work in general, an extra attribute in an element seems less likely to be a problem than unexpected information in an attribute defined by the W3 specs Yeah, and I immediately imagine people that use some attributes that are supposed to be not used by MS and suddenly its an XForms attribute that is already implemented by - oh - Opera. http://my.opera.com/hallvors/blog/show.dml/476181 -- Klaus ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Of extendos, metadata and valid XHMTL - Is it ok to add attributes to elements?
Ⓙⓐⓚⓔ schrieb: have you ever made a dtd that the validator likes? I gave up on that a while back! good luck! Yes, unless you don't use *real* xml/xhtml there's not a real chance to have a validator ever use your specified dtd. so the whole thing is kind of theoretical. -- klaus ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] IE6 + Form Validator bug object dosent support this property or method
no one answered me, guess i wrote the subject worng ... please help ... when i run form validator from http://bassistance.de/jquery-plugins/jquery-plugin-validation/ , after putting the uncompressed version, its working fine in ie 7 but in ie 6 its returns me error: (here is the code: http://www.amir.cx/ajax/test3/stable.php ) [you can also get the source zipped there] object dosent support this property or method line 34 if i just download the files from the site without changes (except of using the uncompressed version) it its returns me error for example at page: custom-methods-demo.html error: line 18, char 2 : $.validator is null or not an object wierd, and im consider if i should use this plugin cause its working fine with ff and ie7 , but 90% of my users have ie6 will be a fix for it soon? or just can zip me a working code ? -- View this message in context: http://www.nabble.com/IE6-%2B-Form-Validator-bug-%22object-dosent-support-this-property-or-method%22-tf3341828.html#a9294202 Sent from the JQuery mailing list archive at Nabble.com. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Re initialise selectables
Did you found a solution yet? I've been asking myself the same question and tried to fix it, but I didn't succeed. Anyone who knows how to 'reinitialize' the selectables? I've prepared a showcase: http://www.peterriet.net/temp/selectables/ Any help would be great! Thanks! Peter Riet floepi wrote: Hi, i am using ajax to search for users and call the selectables function on the found set afterwards. function makeSelectable(){ $('#mainWindow').Selectable( { accept : 'selectableitem', selectedclass : 'selecteditem', helperclass : 'selecthelper' } ); } Though when i make another search and call Selectables again, i still get the helper class (the div that gets created and shows the nice drag window) but the new found set can't be selected any more. I guess there is already a selectables object in the dom and won't overwrite or something. Anybody knows how to solve this . Thanks Phil -- View this message in context: http://www.nabble.com/Re-initialise-selectables-tf2654220.html#a9294614 Sent from the JQuery mailing list archive at Nabble.com. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] onClickOut?
Is there some way of making a bind function so that, one you click away from an element (say drop down menu) it disapears. So say i've clicked a button and a menus poped up, i then taken a look at the menu and i dont need it again, so i click on some other part of the page and the menu hides it self again. Any ideas? -- View this message in context: http://www.nabble.com/onClickOut--tf3341987.html#a9294608 Sent from the JQuery mailing list archive at Nabble.com. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] onClickOut?
Philip Pryce schrieb: Is there some way of making a bind function so that, one you click away from an element (say drop down menu) it disapears. So say i've clicked a button and a menus poped up, i then taken a look at the menu and i dont need it again, so i click on some other part of the page and the menu hides it self again. Any ideas? Philip, there is the one function, that does exactly what you need. $('#target').one('click', function() { ... }); -- Klaus ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] onClickOut?
Hmm.. maybe capture a focus event? Like $(document).not(#menu).bind(focus, function() { .../* menu hide code */...}); Chris ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] jqModal r7 release!
Brice, Is there any way I can change the callback functions after the initial .jqm() call? I'm wanting to have a standard widget that performs similar to the prompt() function in javascript. But I want to dynamically add a callback depending on when/where in the site it's being used. Cheers, Chris ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] Some info on the two Require plugins?
There are two Require plugins in the wiki: http://dev.jquery.com/wiki/Plugins/require--by Jose Paris http://dev.jquery.com/wiki/Plugins/requirex --by Mohd Khairi Lamsah and I'm trying to figure out which is better, if at all. The only real difference I can detect is that Mohd's explicity says it can load plugins in a specified sequence, and with a single statement, whereas Jose's looks like it'll only do one at a time. Is that pretty much it, or am I missing something deeper? If it helps anything, the situation is that I'd be providing a way to integrate jQuery into an application as various modules(base jQ, Interface, etc) that other developers can then make use of. But they don't necessarily know what modules will already be there, so want to also have a way for them to ensure their plugins won't explode if some user hasn't installed a particular plugin yet. Thanks for any details. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] onClickOut?
I've tried that, and jQuery Complains about the function one not existing. Yes, i'm using the latest version of jQuery too. Klaus Hartl wrote: Philip Pryce schrieb: Is there some way of making a bind function so that, one you click away from an element (say drop down menu) it disapears. So say i've clicked a button and a menus poped up, i then taken a look at the menu and i dont need it again, so i click on some other part of the page and the menu hides it self again. Any ideas? Philip, there is the one function, that does exactly what you need. $('#target').one('click', function() { ... }); -- Klaus ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ -- View this message in context: http://www.nabble.com/onClickOut--tf3341987.html#a9295488 Sent from the JQuery mailing list archive at Nabble.com. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] onClickOut?
That doesnt seem to work ether. Could you posibly recomend anything else? Chris Domigan wrote: Hmm.. maybe capture a focus event? Like $(document).not(#menu).bind(focus, function() { .../* menu hide code */...}); Chris ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ -- View this message in context: http://www.nabble.com/onClickOut--tf3341987.html#a9295513 Sent from the JQuery mailing list archive at Nabble.com. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] onClickOut?
Try binding the 'blur' event to to the element you are working with. -- Felix -- http://www.thinkingphp.org http://www.fg-webdesign.de Philip Pryce wrote: That doesnt seem to work ether. Could you posibly recomend anything else? Chris Domigan wrote: Hmm.. maybe capture a focus event? Like $(document).not(#menu).bind(focus, function() { .../* menu hide code */...}); Chris ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] onClickOut?
Thanks that works, yet i have to focus the menu for it work, but it gives the menu a dotted border, any way of removing the border, yet the menu still being focused? Felix Geisendörfer wrote: Try binding the 'blur' event to to the element you are working with. -- Felix -- http://www.thinkingphp.org http://www.fg-webdesign.de Philip Pryce wrote: That doesnt seem to work ether. Could you posibly recomend anything else? Chris Domigan wrote: Hmm.. maybe capture a focus event? Like $(document).not(#menu).bind(focus, function() { .../* menu hide code */...}); Chris ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ -- View this message in context: http://www.nabble.com/onClickOut--tf3341987.html#a9295818 Sent from the JQuery mailing list archive at Nabble.com. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] onClickOut?
any way of removing the border, yet the menu still being focused? Not sure about IE, but for FF this CSS should work: element:focus{-moz-outline-style: none;} -- http://www.thinkingphp.org http://www.fg-webdesign.de Philip Pryce wrote: Thanks that works, yet i have to focus the menu for it work, but it gives the menu a dotted border, any way of removing the border, yet the menu still being focused? Felix Geisendörfer wrote: Try binding the 'blur' event to to the element you are working with. -- Felix -- http://www.thinkingphp.org http://www.fg-webdesign.de Philip Pryce wrote: That doesnt seem to work ether. Could you posibly recomend anything else? Chris Domigan wrote: Hmm.. maybe capture a focus event? Like $(document).not(#menu).bind(focus, function() { .../* menu hide code */...}); Chris ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] jqModal r7 release!
Chris Domigan wrote: Is there any way I can change the callback functions after the initial .jqm() call? I'm wanting to have a standard widget that performs similar to the prompt() function in javascript. But I want to dynamically add a callback depending on when/where in the site it's being used. Chris, This is possible, although undocumented -- as there is no graceful API function to grab the jqModal hash of an element. It is important to note that jqModal functionality is closely tied to the hash , and each jqModal-ized element ($(e).jqm()) is assigned a serial which points to its configuration object within the hash. Conveniently, the hash is globally available via $.jqm.hash, and an jqModalized element's serial is available as an expando named _jqm. Thus; var jqmElementHash = $.jqm.hash[$(jqmElement)[0]._jqm]; would correctly assign (and allow you to play with) the jqmElement's hash object. The hash object's properties are documented in the README, but as an example, here's how you would change a jqModal's onShow callback; -- // accepts an element (either DOM or jQuery obj) function changeOnShow(element, newCallback) { var h=$.jqm.hash[$(element)[0]._jqm]; return h.c.onShow = newCallback; } Hope this helps and makes sense! NOTE; in *early* versions $.jqm.hash was available globally. In newer (r6-r9?), the hash was moved to the scope of the plugin. In r10 beta (available on plugin page), the hash is again globally available @ $.jqm.hash. Other minor improvements have been made, including Dimitry's compressable fixes. See; http://dev.jquery.com/jquery/jqModal/ ~ Brice ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] jqModal r7 release!
Thanks for that Brice. Another thought - is it possible to get the element that triggered the jqmShow)? So if I have n anchor elements with class of jqmShow, the modal object (once triggered) will have a reference to its calling element? Cheers, Chris ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] How Do i Assign error div to JQuery Validator Plugin Alpha 2 ?
hey, i got the following code (i fixed the ie6 bugs and stuff) now i need to figure out how can i assign the div the shows errors in each input? i saw the demos but the problem is that i want to control on each div position with my css.. .is that possible ? or anyone can shows me how to do it in diffrent way that i will able to control the positions on each error div? (i mean the div id=password-errordivplease enter password/div divs'...) ill be glad if someone will paste me a demo into this code or similar thanks !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd; html xmlns=http://www.w3.org/1999/xhtml; head script type=text/javascript src=jquery/jquery.js/script script type=text/javascript src=jquery/jquery.form.js/script script type=text/javascript src=jquery/jquery.block.js/script script type=text/javascript src=jquery/cmxforms.js/script script type=text/javascript src=jquery/metadata.js/script script type=text/javascript src=jquery/val.js/script script type=text/javascript function pre(formdata) { $(#ab).html('loading'); } function po(response) { var response = eval('('+ response +')'); if( response.status != error ) { statusmsg = Thanks for the submit; } else { statusmsg = Your form submission was not succesful; } $(#ab).html(response.data ); } var options = { beforeSubmit: pre, // pre-submit callback success: po, // post-submit callback type:'post', url: 'test2.php' }; $(document).ready(function() { // bind form using 'ajaxForm' $(#amir).validate({ submitHandler: function(form) { $(form).ajaxSubmit(options); } }); }); /script /head body form name=amir id=amir class=amir label for=passwordpassword/label input name=password type=text id=password div id=password-errordivplease enter password/div label for=firstnamefirstname/label input name=firstname type=text id=firstname div id=firstname-errordivPlease fill the name!/div input type=submit name=Submit value=Submit /formdiv id=absdsd/div /body /html -- View this message in context: http://www.nabble.com/How-Do-i-Assign-error-div-to-JQuery-Validator-Plugin-Alpha-2---tf3342587.html#a9296307 Sent from the JQuery mailing list archive at Nabble.com. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] jqModal r7 release!
Chris Domigan wrote: Another thought - is it possible to get the element that triggered the jqmShow)? So if I have n anchor elements with class of jqmShow, the modal object (once triggered) will have a reference to its calling element? Chris, Sure thing. The last triggering element is stored in the hash as t (see the README). Also, the hash is passed to the onShow, onHide, and onLoad callbacks as the first argument. So; $(e).jqm({onShow: showCallback}); function showCallback(hash) { // get the triggering element var trigger = hash.t; } Is an example. My previous post shows how to access the hash globally, so you can see who the last trigger of an jqModalized element was OUTSIDE any callbacks. Hope this helps, ~ Brice ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] jqModal r7 release!
Excellent - just what I needed! Sterling effort. Cheers ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] $(node).hasClass(...) function
Hi, This is not very obvious, and I guess some people won't notice that is offers the same functionalities as a potential hasClass... from a developer friendly point of view, I think it would be better to have addClass/toggleClass/hasClass rather than addClass/ toggleClass/is. Just my 2c ;) -- Sébastien Le 07-03-02 à 13:30, John Resig a écrit : give this a try: $(node).is(.class) --John On 3/2/07, Sébastien Pierre [EMAIL PROTECTED] wrote: Hi all, I was wondering if somebody would be interested in a hasClass(...) function for jQuery. I would definitely find it useful, and am willing to contribute it. -- Sébastien ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] Packing script
Hello, Maybe off, sorry. I made a little script, and I like to pack it. I try to use the js.jar what is in the svn version of jquery. I try with the next command: java -jar ./build/js.jar ./build/build/pack.js szamolo.js ./szamolo.pack.js But, when I like to use the szamolo.pack.js instead of szamolo.js I get the following error: missing ; before statement Before packing, I put semicolon after every line. How can I pack my script? -- Ámon Tamás http://linkfelho.amon.hu ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] jQuery + ColdFusion - auto complete examples?
Here's a quick example: http://www.co-opcookbook.com/test.cfm It's not working 100% right now, I think due to the way mySQL stores the data (extra carriage returns at the end maybe). But here's the code for it (note, this uses an older version of jQuery). I haven't take the time to update this example page. Here's TEST.cfm html head title the recipe MANAGER/title script language=javascript src=includes/jquery.js type=text/javascript/script script language=javascript src=includes/autocomplete.js type=text/javascript/script link href=includes/styles.css rel=stylesheet type=text/css / style type=text/css !-- /* set the page background color and margins. */ body { margin: 20px; } -- /style script type=text/javascript function selectItem(li) { if (li.extra) { $('#fk_ing_id').val(li.extra); } } function formatItem(row) { return row[0]; } $(document).ready(function() { var curID = 0; $(#ingredient).autocomplete(search.cfm, { minChars:1, matchSubset:1, matchContains:1, cacheLength:10, onItemSelect:selectItem, formatItem:formatItem, selectOnly:1 }); $('#saveandadd').click( function() { curID++; // get value from quanty drop downs var whole = $('#wQty').val(); var fraction = $('#fQty').val(); var qty = parseInt(whole) + (fraction*1); var unitID = $('#unit').val(); var unitText = $('#unit option:selected').text(); alert(unitText); var ing = $('#ingredient').val(); // duplicate the template row $('#template').clone().id(curID).appendTo('#ingHeader').removeClass('hideMe' ); // set the values $('#' + curID).html(qty + ' ' + unitText + ' ' + ing) }) }); /script /head body brbr cfquery name=getUnit dataSource=#Application.DSN# username=#APPLICATION.user# password=#Application.pass# SELECT * FROM r_unit ORDER BY recunit_name /cfquery cfquery name=getFraction dataSource=#Application.DSN# username=#APPLICATION.user# password=#Application.pass# SELECT * FROM r_fractions WHERE numerator != 0 ORDER BY value /cfquery cfoutput fieldset id=entry legendIngredient Entry/legend select id=wQty class=addIng option value=0--/option cfloop index=q from=1 to=50 option value=#q##q#/option /cfloop /selectnbsp;nbsp; (and select id=fQty class=addIng option value=0--/option cfloop query=getFraction option value=#value##numerator#/#denominator#/option /cfloop /select )nbsp;nbsp; select id=unit class=addIng cfloop query=getUnit option value=#recunit_id##recunit_name#/option /cfloop /selectnbsp;nbsp; input type=text id=ingredient class=addIng input type=hidden id=fk_ing_id value= nbsp;nbsp; input type=button id=saveandadd value=Save Add Another /fieldset /cfoutput div id=ingHeaderbIngredient Data/b/div div id=template class=hideMe ingData/div /body /html And here's search.cfm cfquery name=get dataSource=#Application.DSN# username=#APPLICATION.user# password=#Application.pass# SELECT * FROM r_ingredients WHERE rec_list_ingredient LIKE cfqueryparam value=%#Trim(URL.q)#% cfsqltype=CF_SQL_VARCHAR /cfquery cfoutput query=get#rec_list_ingredient#|#rec_list_id# /cfoutput -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Priest, James (NIH/NIEHS) [C] Sent: Monday, February 26, 2007 8:32 AM To: jQuery Discussion. Subject: [jQuery] jQuery + ColdFusion - auto complete examples? I'm working on an administration tool and I'd like to use jQuery to populate a user field - IE the user would type in a few letters of the last name and have it find the matching names... I know there are lots of ColdFusion folks on the list - I'm looking for some examples :) I've used jQuery quite a bit in the rest of this application but it's all been for display/UI - no Ajax - so now I want to give that a try. Thanks! Jim ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] New Plugin: clickMenu
Hey there, I've created a plugin to make a clickable, application-like dropdown menu out of an unordered list. Information about it can be found at: http://p.sohei.org There is still some work to do, to make it really usable (I'm new to this) but nonetheless please let me know what you think about it, any feedback will be appreciated. /rw ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Packing script
http://dean.edwards.name/packer/ On 2/26/07, Ámon Tamás [EMAIL PROTECTED] wrote: Hello, Maybe off, sorry. I made a little script, and I like to pack it. I try to use the js.jar what is in the svn version of jquery. I try with the next command: java -jar ./build/js.jar ./build/build/pack.js szamolo.js ./szamolo.pack.js But, when I like to use the szamolo.pack.js instead of szamolo.js I get the following error: missing ; before statement Before packing, I put semicolon after every line. How can I pack my script? -- Ámon Tamás http://linkfelho.amon.hu ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ -- Joan Piedra || Frontend webdeveloper http://joanpiedra.com/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] $(node).hasClass(...) function
Hi guys, I think it's absolutely worth thinking about adding a hasClass shortcut to the core, since I also missed the shortcut many times. the is() function is pretty nice, but people would really guess there is a hasClass. -Paul 2007/3/4, Sébastien Pierre [EMAIL PROTECTED]: Hi, This is not very obvious, and I guess some people won't notice that is offers the same functionalities as a potential hasClass... from a developer friendly point of view, I think it would be better to have addClass/toggleClass/hasClass rather than addClass/ toggleClass/is. Just my 2c ;) -- Sébastien Le 07-03-02 à 13:30, John Resig a écrit : give this a try: $(node).is(.class) --John On 3/2/07, Sébastien Pierre [EMAIL PROTECTED] wrote: Hi all, I was wondering if somebody would be interested in a hasClass(...) function for jQuery. I would definitely find it useful, and am willing to contribute it. -- Sébastien ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ -- -- Paul Bakaus ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] onClickOut?
Hey Yehuda, .one('event',fn) has not been deprecated, as far as I know. Only the individual .oneEvent(fn) methods have. --Karl _ Karl Swedberg www.englishrules.com www.learningjquery.com On Mar 4, 2007, at 8:21 AM, Yehuda Katz wrote: one has been deprecated since 1.1. For the same effect, you *might* be able to do e.unbind() inside the event handler, as such: $(#n).click(function(e) { e.unbind(); // code; return false; }); I'm not 100% that syntax made it in. That said, I don't think that's what you're looking for. I think you want to bind a click on body, and test to make sure that e.target is not the element in question. $(#n).click(function(e) { var self = this; $(#menu).show(); $(body).click(function() { if(e.target != self e.target != $(#menu)[0]) $ (#menu).hide(); }) }) Something like the above has worked for me in the past (obviously with more code to actually DO what you're trying to accomplish). On 3/4/07, Klaus Hartl [EMAIL PROTECTED] wrote: Philip Pryce schrieb: Is there some way of making a bind function so that, one you click away from an element (say drop down menu) it disapears. So say i've clicked a button and a menus poped up, i then taken a look at the menu and i dont need it again, so i click on some other part of the page and the menu hides it self again. Any ideas? Philip, there is the one function, that does exactly what you need. $('#target').one('click', function() { ... }); -- Klaus ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ -- Yehuda Katz Web Developer | Wycats Designs (ph) 718.877.1325 ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] got troubled returning combined data: html+javascript
Hi, guys! I've got in 1.html something about $(document).ready(function() { var h = $.ajax({url: test.html,async: false,dataType:'html'}).responseText; $('body').append(h); }); test.html contains smth about that pTest data/p script type=text/javascript /*![CDATA[*/ alert('test'); /*]]*/ /script The trouble is: in firefox returned script alerts twice: first on return second on append In IE and Opera this script works fine Is there any easy way to solve this problem? -- Best regards, Marat ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] $(node).hasClass(...) function
Maybe .hasClass() would be helpful, but keep in mind that .is() offers /more/ functionalities than .hasClass() would. For example ... $('.class').is('#my-id') $('p').is(':visible') $('div').is('[a]') I'm not necessarily opposed to having .hasClass(), but I really love the flexibility of .is(). --Karl _ Karl Swedberg www.englishrules.com www.learningjquery.com On Mar 4, 2007, at 10:07 AM, Sébastien Pierre wrote: Hi, This is not very obvious, and I guess some people won't notice that is offers the same functionalities as a potential hasClass... from a developer friendly point of view, I think it would be better to have addClass/toggleClass/hasClass rather than addClass/ toggleClass/is. Just my 2c ;) -- Sébastien Le 07-03-02 à 13:30, John Resig a écrit : give this a try: $(node).is(.class) --John On 3/2/07, Sébastien Pierre [EMAIL PROTECTED] wrote: Hi all, I was wondering if somebody would be interested in a hasClass(...) function for jQuery. I would definitely find it useful, and am willing to contribute it. -- Sébastien ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Of extendos, metadata and valid XHMTL - Is it ok to add attributes to elements?
My main issue, I think, is that I don't like the idea of mixing 2 different types of data in one attribute. I like keeping everything separated, but that's just me ;) Klaus Hartl wrote: Ⓙⓐⓚⓔ schrieb: I think there is no risk! classes are ours to use (or abuse)... no sane (not even IE) browser would co-opt classes from the masses! Yes, Jake is right of course. As long you know what classes you use, what's the problem? -- Klaus ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ -- View this message in context: http://www.nabble.com/Of-extendos%2C-metadata-and-valid-XHMTL---Is-it-ok-to-add-attributes-to-elements--tf3337204.html#a9297679 Sent from the JQuery mailing list archive at Nabble.com. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] Best practices for reattaching behaviours to dynamically loaded content?
As site developers using jQuery, we often attach jQuery behaviours through an attach function that's registered with $(document).ready();. Typically, behaviours attach to content identified by jQuery selectors, e.g., id or class values. This works great for the initial DOM ready state. But how can we ensure that these same behaviours are also attached to content loaded via ajax? Of course, if I'm using all my own behaviours I can simply hack them to apply to ajax-loaded content. But the question is, how can we structure all our behaviours in such a way that others can use them for both 'normal' and ajax-loaded content? There are two parts to this issue: _ (a) Behaviours list: How can we know what behaviours need to be reattached? To reattach all behaviours to newly loaded and rendered content, we need to know what behaviours exist. (b) Avoiding duplication: How can we ensure that behaviours are attached only to newly loaded content? If we simply rerun the original attachment code, we may end up with multiple behaviour instances attached to individual elements that the behavours were already attached to. _ A concrete example: in Drupal we have various jQuery behaviours that may be attached to content on page ready: autocomplete text fields, collapsing fieldsets, etc. These are registered through $(document).ready. If we ajax load and render new content, though, it doesn't get the behaviours and so is broken. If we manually call the functions that attach the behaviours, we get duplicate behaviours (e.g., two icons for collapsing fieldsets). Issue (b) seems relatively easy to address. One way is by filtering the jQuery selector by class name and then adding that class to all processed content: $('div.mybehavior:not(.mybehavior-processed)').each(function() { $(this) ... .addClass('mybehavior-processed'); }); Is this the best way? Issue (a) is more difficult. We can't rely on what was registered through $(document).ready() because the jQuery.readyList is emptied after being used. One possible approach would be to extend jQuery with array of behaviours. Here's a rough idea: jQuery.extend({ behaviors: [], registerBehavior: function(attachFunction) { jQuery.behaviors.push(attachFunction); jQuery.readyList.push(attachFunction); }); jQuery.each( attachBehaviors: function() { var elt = this; if ( jQuery.behaviors) { // Execute all of them jQuery.each( jQuery.behaviors, function(){ this.apply( elt ); }); } }); Then, for behaviours, we would register them with $.registerBehavior(mybehaviourAttach); and then call after ajax-loading content with $(elt).attachBehaviors(); Is this a good general approach? Are there better solutions? What are people currently doing to address this issue? Thanks, Nedjo Rogers ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Best practices for reattaching behaviours to dynamically loaded content?
I found that the simplest way to handle all of this is to make use of the context parameter of jQuery. Basically write your attachBehaviors function like this: var attachBehaviors = function(context) { context = context || document; $('a', context).bind('click', ...); $('#product', context).bind('mouseover', ...); // etc. } Then whenever you load some new content via ajax all you have to do is to pass a context element as a parameter to attachBehaviors. This will usually be the element that you updated using ajax ; ). Let me know if this is good enough for what you are trying to do? -- Felix Geisendörfer -- http://www.thinkingphp.org http://www.fg-webdesign.de Nedjo Rogers wrote: As site developers using jQuery, we often attach jQuery behaviours through an attach function that's registered with $(document).ready();. Typically, behaviours attach to content identified by jQuery selectors, e.g., id or class values. This works great for the initial DOM ready state. But how can we ensure that these same behaviours are also attached to content loaded via ajax? Of course, if I'm using all my own behaviours I can simply hack them to apply to ajax-loaded content. But the question is, how can we structure all our behaviours in such a way that others can use them for both 'normal' and ajax-loaded content? There are two parts to this issue: _ (a) Behaviours list: How can we know what behaviours need to be reattached? To reattach all behaviours to newly loaded and rendered content, we need to know what behaviours exist. (b) Avoiding duplication: How can we ensure that behaviours are attached only to newly loaded content? If we simply rerun the original attachment code, we may end up with multiple behaviour instances attached to individual elements that the behavours were already attached to. _ A concrete example: in Drupal we have various jQuery behaviours that may be attached to content on page ready: autocomplete text fields, collapsing fieldsets, etc. These are registered through $(document).ready. If we ajax load and render new content, though, it doesn't get the behaviours and so is broken. If we manually call the functions that attach the behaviours, we get duplicate behaviours (e.g., two icons for collapsing fieldsets). Issue (b) seems relatively easy to address. One way is by filtering the jQuery selector by class name and then adding that class to all processed content: $('div.mybehavior:not(.mybehavior-processed)').each(function() { $(this) ... .addClass('mybehavior-processed'); }); Is this the best way? Issue (a) is more difficult. We can't rely on what was registered through $(document).ready() because the jQuery.readyList is emptied after being used. One possible approach would be to extend jQuery with array of behaviours. Here's a rough idea: jQuery.extend({ behaviors: [], registerBehavior: function(attachFunction) { jQuery.behaviors.push(attachFunction); jQuery.readyList.push(attachFunction); }); jQuery.each( attachBehaviors: function() { var elt = this; if ( jQuery.behaviors) { // Execute all of them jQuery.each( jQuery.behaviors, function(){ this.apply( elt ); }); } }); Then, for behaviours, we would register them with $.registerBehavior(mybehaviourAttach); and then call after ajax-loading content with $(elt).attachBehaviors(); Is this a good general approach? Are there better solutions? What are people currently doing to address this issue? Thanks, Nedjo Rogers ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Submit a form (POST) to a Thickbox panel
Use Thickbox in iframe mode and bounce the content off your server. Otherwise, manually get the values from the form and generate a div with the preview content in it (all from javascript). Submit form data to an iframe is a flawed idea. --Erik On 3/4/07, Seb Duggan [EMAIL PROTECTED] wrote: I'm working on a CMS application, and want to create a preview button. What I want it to do is take the form content, pass it to a preview page which will be loaded into a Thickbox (or similar) overlay, but not submit the main form. The content of the form is likely to be too long to send as GET data, so POST will be required. Any ideas? Seb ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Best practices for reattaching behaviours to dynamically loaded content?
I keep all my behaviours in separate functions. For instance if I had a fancy table widget I'd have a function called initTable() that contained the behaviour code. I'd call it initially upon page load, then call it again when necessary if content has been updated via ajax. Eg. $(document).ready() { initPage(); // misc page stuff that won't be refetched from ajax initTable(); initOtherStuff(); }); function initPage() { ... } function initTable() { ... } etc. Then if I need to refresh something in the table via ajax I just call initTable() in the callback of my ajax function. Chris ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Submit a form (POST) to a Thickbox panel
I see how to do this with a normal HTML page, but how do I submit the data via POST and get the resulting page into a Thickbox iframe? Seb On 4 Mar 2007, at 19:16, Erik Beeson wrote: Use Thickbox in iframe mode and bounce the content off your server. On 3/4/07, Seb Duggan [EMAIL PROTECTED] wrote: I'm working on a CMS application, and want to create a preview button. What I want it to do is take the form content, pass it to a preview page which will be loaded into a Thickbox (or similar) overlay, but not submit the main form. The content of the form is likely to be too long to send as GET data, so POST will be required. Any ideas? Seb ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Submit a form (POST) to a Thickbox panel
I see. I don't think that functionality is built in to Thickbox. It probably wouldn't be too hard to hack it to do that. Google 'iframe post' for info on the HTML necessary to make it happen. Or just use GET. Good luck. --Erik On 3/4/07, Seb Duggan [EMAIL PROTECTED] wrote: I see how to do this with a normal HTML page, but how do I submit the data via POST and get the resulting page into a Thickbox iframe? Seb On 4 Mar 2007, at 19:16, Erik Beeson wrote: Use Thickbox in iframe mode and bounce the content off your server. On 3/4/07, Seb Duggan [EMAIL PROTECTED] wrote: I'm working on a CMS application, and want to create a preview button. What I want it to do is take the form content, pass it to a preview page which will be loaded into a Thickbox (or similar) overlay, but not submit the main form. The content of the form is likely to be too long to send as GET data, so POST will be required. Any ideas? Seb ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] jquery flash sIFR fla file
I am playing around with the flash plugin for jquery trying to get the sIFR woking within a site. I have downloaded the fla file but it does not open in my flash 7 http://jquery.lukelutman.com/plugins/flash/jfr.fla I was hoping that either Luke or someone might be able either send me a fla (that works with flash mx 2004 off list) or provide some instruction on how to customise the sIFR 2 flash files. thanks - S ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] $(node).hasClass(...) function
Absolutely Karl - the is() method is wonderful, I use it quite often. But there are often more ways to achieve the same things, sometimes it's just a matter of taste. Anyway - a hasClass method would probably even save a few ms compared to is() in my opinion, because you don't need to parse stuff. 2007/3/4, Karl Swedberg [EMAIL PROTECTED]: Maybe .hasClass() would be helpful, but keep in mind that .is() offers /more/ functionalities than .hasClass() would. For example ... $('.class').is('#my-id') $('p').is(':visible') $('div').is('[a]') I'm not necessarily opposed to having .hasClass(), but I really love the flexibility of .is(). --Karl _ Karl Swedberg www.englishrules.com www.learningjquery.com On Mar 4, 2007, at 10:07 AM, Sébastien Pierre wrote: Hi, This is not very obvious, and I guess some people won't notice that is offers the same functionalities as a potential hasClass... from a developer friendly point of view, I think it would be better to have addClass/toggleClass/hasClass rather than addClass/ toggleClass/is. Just my 2c ;) -- Sébastien Le 07-03-02 à 13:30, John Resig a écrit : give this a try: $(node).is(.class) --John On 3/2/07, Sébastien Pierre [EMAIL PROTECTED] wrote: Hi all, I was wondering if somebody would be interested in a hasClass(...) function for jQuery. I would definitely find it useful, and am willing to contribute it. -- Sébastien ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ -- -- Paul Bakaus ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] jqUploader updated
Alexandre, Is there any way to debug this plugin? For instance jqUploader has just stopped posting to my server side script for some reason, and it would be handy to see what sort of error it is throwing. Cheers, Chris ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] How Do i Assign error div to JQuery Validator Plugin Alpha 2 ?
amircx schrieb: hey, i got the following code (i fixed the ie6 bugs and stuff) now i need to figure out how can i assign the div the shows errors in each input? i saw the demos but the problem is that i want to control on each div position with my css.. .is that possible ? or anyone can shows me how to do it in diffrent way that i will able to control the positions on each error div? That is the last feature that I'm going to implement in 1.0. I'll release the first beta once that is in, please be patient until then :-) Regards -- Jörn Zaefferer http://bassistance.de ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] jQuery Tags Autocomplete
I have a table with tags. Now I downloaded the autocomplete from jQuery plugin Modified Auto-complete by Anjesh Tuladhar, http://just-tech.blogspot.com/2006/12/jquery-tweaking-auto-complete-plugin.html. But I don't understand how to connect these two. First, I have retrieved tags from the table and put them in the list. Now how do I pass this to autocomplete. I am new to javaScript. Thank you. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] How to find some consequent elements
I need to find some consequent elements of one type from some point in DOM For example, I have: div id=start.../divinput id=id1/input id=id2/input id=idN/div/divinput id=out/ I need to find all inputs (from 1 to N) and not to find input with id=out if I use $(#start).siblings(input) I will find all inputs including input with id=out I do not know Id or class of this wronginput - so I cannot filter it I need to find ONLY consequent elements of one type... that means any other element (like DIV in our example) will break this consequence. I would appreciate any advice, Dmitry -- View this message in context: http://www.nabble.com/How-to-find-some-consequent-elements-tf3344703.html#a9302237 Sent from the JQuery mailing list archive at Nabble.com. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Submit a form (POST) to a Thickbox panel
U could generate a div with the info from the form and use thickbox internal function TB_show, like this: $(preview).click( function () { //generate a div with the contents of the form and then call thickbox with: TB_show(Post preview, #TB_inline?height=300width=300inlineId=divId, false); }); I think something like that should work //Kristinn On 3/4/07, Seb Duggan [EMAIL PROTECTED] wrote: I'm working on a CMS application, and want to create a preview button. What I want it to do is take the form content, pass it to a preview page which will be loaded into a Thickbox (or similar) overlay, but not submit the main form. The content of the form is likely to be too long to send as GET data, so POST will be required. Any ideas? Seb ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] How to find some consequent elements
Dmitry Rudakov wrote: For example, I have: div id=start.../divinput id=id1/input id=id2/input id=idN/div/divinput id=out/ I need to find all inputs (from 1 to N) and not to find input with id=out if I use $(#start).siblings(input) I will find all inputs including input with id=out Dmitry, As an example, you can use var elements = $('input',$('#start')).not('#out'); I am sure others will have other suggestions. ~ Brice ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Packing script
Ámon Tamás schrieb: Hello, Maybe off, sorry. I made a little script, and I like to pack it. I try to use the js.jar what is in the svn version of jquery. I try with the next command: java -jar ./build/js.jar ./build/build/pack.js szamolo.js ./szamolo.pack.js But, when I like to use the szamolo.pack.js instead of szamolo.js I get the following error: missing ; before statement Before packing, I put semicolon after every line. How can I pack my script? There was a bug in the build files in svn. Make sure to get the latest version so you don't have that. Otherwise: Check your code again. There problem maybe not as obivous. Look for something like this: var bla = function() { // stuff } - missing semicolon // other stuff -- Jörn Zaefferer http://bassistance.de ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] ISO docs for $.fn ?
Hi. I'm just learning about jQuery and finding my way around its documentation. I have not been able to find any documentation on $.fn. In fact in some of the rest of the documentation (e.g. the example code for $.extend given at http://visualjquery.com/1.1.1.html, $.fn (or rather jQuery.fn ) without explanation. Actually, the examples given there raise many questions in my mind, for example: what's the difference between $.fn and jQuery.fn? And, what's the difference between calling jQuery.fn.extend and jQuery.extend? Are the answers to these questions in the documentation? If so, please point me to them. Any help would be much appreciated. TIA! kj ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Of extendos, metadata and valid XHMTL - Is it ok to add attributes to elements?
Daemach schrieb: Actually I think I may just modify the validator code to read out of a custom expando. It would be nice to be able to pass the attribute name to the validator engine directly though... Jorn? ==(sorry - I don't know how to do the fancy o ;) Heh, . Just copypaste the next time you need it ;) Actually the custom attribute is already supported: Just tell the metadata plugin to do so, and the validator uses it. Put this in front of any other code that uses the metadata (eg. validation): $.meta.setType(attr, validate) And replace validate with anything you like as a custom attribute. In case you need to use the classes, make sure to avoid any spaces, eg. class={require:true,email:true} can't be confused by any browser with any actual style class, because the curly braces are illegal characters for style classes. -- Jörn Zaefferer http://bassistance.de ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] How to find some consequent elements
Brice Burgess wrote: Dmitry, As an example, you can use var elements = $('input',$('#start')).not('#out'); I am sure others will have other suggestions. Bruce, I do not know ID or something else about these wrong inputs ... #out was just for example I should break this sequence only when I meet any other element NOT input... that's why I cannot use filter() or not() I find a solution but it doesn't look a simple and elegant... $('input',$('#start')).filter( function(index) {return $(this).prev().is(input) || $(this).next().is(input);}); that's why I ask for some help... thanks, Dmitry -- View this message in context: http://www.nabble.com/How-to-find-some-consequent-elements-tf3344703.html#a9303000 Sent from the JQuery mailing list archive at Nabble.com. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] A newbie question abotu jCarousel+jQuery
Hi; I am new in jQuery and also not well in JavaScript enough... I have been developing a modified version of jCarousel plugin of jQuery... I try to tell the problem with code: function loadItemHandler(carousel, start, last, available) { if (available) { // Trigger loaded carousel.loaded(); return; } var cr = carousel; var cid = ''; $(#lin).hover(function() { jQuery(this).css({color:red,cursor:pointer});}, function(){ jQuery(this).css({color:green,cursor:pointer});} ); $(#lin).click( function() //section 1 { cid = $(this).attr(cid); jQuery.get(components/com_creme/creme.ajax.php?cid=+cid, function(data) { appendItemCallback(cr, start, last, data); }); }, function() //section 2 { jQuery.get(components/com_creme/creme.ajax.php, function(data) { appendItemCallback(cr, start, last, data); }); } ) }; There are span tags with id=lin and a cid attribute whose value is variable. ( example : span id=lin cid=5test/span ) I try to succeed that when nothing is clicked section 2 must be runned, otherwise section 1 must be runned when any link clicked. Note: After clicking any link section 2 mustnot be runned tHanks for any help and sorry for my bad English... ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Of extendos, metadata and valid XHMTL - Is it ok to add attributes to elements?
Thanks for the info on the metadata plugin. Make sure to avoid any spaces... is exactly the kind of gotcha that makes using classes as a data repository so troublesome. While it is technically possible, mixing data types inside an attribute just feels like a bad practice to me. Jörn Zaefferer wrote: Daemach schrieb: Actually I think I may just modify the validator code to read out of a custom expando. It would be nice to be able to pass the attribute name to the validator engine directly though... Jorn? ==(sorry - I don't know how to do the fancy o ;) Heh, . Just copypaste the next time you need it ;) Actually the custom attribute is already supported: Just tell the metadata plugin to do so, and the validator uses it. Put this in front of any other code that uses the metadata (eg. validation): $.meta.setType(attr, validate) And replace validate with anything you like as a custom attribute. In case you need to use the classes, make sure to avoid any spaces, eg. class={require:true,email:true} can't be confused by any browser with any actual style class, because the curly braces are illegal characters for style classes. -- Jörn Zaefferer http://bassistance.de ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ -- View this message in context: http://www.nabble.com/Of-extendos%2C-metadata-and-valid-XHMTL---Is-it-ok-to-add-attributes-to-elements--tf3337204.html#a9303474 Sent from the JQuery mailing list archive at Nabble.com. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] Charting or plotting coming?
Hello everyone, First off, great job so far on jQuery! I'm absolutely in love with it! Second, is there any chance a graphing, charting or plotting plugin is somewhere on the horizon? Something like PlotKit (http://www.liquidx.net/plotkit/) or Solutoire (http://solutoire.com/plotr/barexample/) would be tremendously helpful. I'd try and port those myself, but I don't have too much time as a doc student; likewise, I don't have too much money to offer anyone willing to port those themselves .would $50.00 sway anyone? Best regards, Bernie P.S. I tried submitting this to the plugin list but it seems to be broken. There's no March thread even a few hours after submitting a message. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Need some guidance...
Alright... now I've got this working very well. The only problem I have now is validation. I normally submit a page back to itself, run some checks on the form values and throw up any errors messages before the form processes. However, with the function CalculateMortgage below, I can't do that. So I need some input on how to use jQuery for validation. Is there some info somewhere that will walk me through that? I need the following validation for form input: Principal: There must be an entry and it must be a number after all $ , . are taken out. Interest: There must be an entry and it must be a number after a % sign which might be entered is taken out. Years: There must be an entry and the entry must be numerical. Can anyone point me to some validation technique info that I could draw from? Thanks! Rick === Calc page: script type=text/javascript src=/js/jquery.js/script script type=text/javascript function CalculateMortgage(){ var Params = {}; // select all inputs of type text $(input:text).each(function(){ Params[$(this).attr(name)] = $(this).val(); }); // post the form. The Param object mimics form fields $.post(/path/to/yourdatapage.cfm, Params, function(data){ // this is the processing function. // append what you get back to the element with ID = Result after clearing its contents $(#Result).empty().append(data); } ); } /script form name=f table tr td align=rightstrongPrincipal:/strong/td tdinput type=text name=Principal/td /tr tr td align=rightstrongInterest Rate:/strong/td tdinput type=text name=InterestRate/td /tr tr td align=rightstrongDuration:/strong/td tdinput type=text name=Duration/td /tr tr td align=rightstrongResult:/strong/td tdspan id=Result/span/td /tr tr td align=rightnbsp;/td tdinput type=button value= Calculate onClick=CalculateMortgage();return false;/td /tr /table /form Page from which you are getting the data: cfsetting showdebugoutput=nocfset calc = form.Principal * form.InterestRate * form.Duration cfcontent reset=yescfoutput#DollarFormat(calc)#/cfoutput Rick Faircloth wrote: Hi, Daemach... Thanks for the guidance, but unfortunately, I'm still using CF 4.5, so CFC's are obviously not an option. I plan to upgrade this summer to CF 8 and catch up with everyone. I was looking over your code, too... that complicated stuff! (For someone just starting out, anyway...) After looking over the code, I can begin to see how it's being done... just wish I could use AjaxCFC! Thanks for your time and help! Rick -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Daemach Sent: Wednesday, February 28, 2007 6:00 PM To: discuss@jquery.com Subject: Re: [jQuery] Need some guidance... Hi Rick - This is one of those things I would use ajaxCFC for since it handles serialization automatically. The idea here is that you need to serialize the values of your form fields, send them to the server, deserialize, calculate and put the results into some kind of structure which gets serialized again and returned to the browser for processing which starts with deserializing. Dealing with the serialization/deserialization transparently is what makes ajaxCFC so great. First, download ajaxcfc here: http://www.robgonda.com/blog/projects/ajaxcfc/download.cfm in the zip file drill down to ajaxCFC/branches/jquery/core/. Put the .cfc's in some accessible folder on your web server, then copy everything inside the /js folder to your javascript repository - I create a subfolder to keep it separate: /js/ajaxCFC. That's it for the install. This sample code should get you started. I stuck the ajax call directly into the click event on the button, but you could put all of that in a separate function and then call the function from the click event handler if you want. === your html/cfm page with the calculator: script type=text/javascript src=/js/jquery.js/script script type=text/javascript src=/js/ajaxCFC/jquery.AjaxCFC.js/script script type=text/javascript // additional files $.AjaxCFC({require:'json'}); // more additional files // $.AjaxCFC({require:'json,wddx,dDumper,log4j,DWRSyntax,blockUI'}); // optional global settings
Re: [jQuery] $(node).hasClass(...) function
.hasClass() would just use .is() (or jQuery.filter) internally. Right now we're quickly gaining filesize without even adding new features (only dealing with bug fixes). For now, .is() will have to suit. Another option would be to add an entry for .hasClass() in the documentation, but in its details, point the user towards .is() instead. --John On 3/4/07, Paul Bakaus [EMAIL PROTECTED] wrote: Absolutely Karl - the is() method is wonderful, I use it quite often. But there are often more ways to achieve the same things, sometimes it's just a matter of taste. Anyway - a hasClass method would probably even save a few ms compared to is() in my opinion, because you don't need to parse stuff. 2007/3/4, Karl Swedberg [EMAIL PROTECTED]: Maybe .hasClass() would be helpful, but keep in mind that .is() offers /more/ functionalities than .hasClass() would. For example ... $('.class').is('#my-id') $('p').is(':visible') $('div').is('[a]') I'm not necessarily opposed to having .hasClass(), but I really love the flexibility of .is(). --Karl _ Karl Swedberg www.englishrules.com www.learningjquery.com On Mar 4, 2007, at 10:07 AM, Sébastien Pierre wrote: Hi, This is not very obvious, and I guess some people won't notice that is offers the same functionalities as a potential hasClass... from a developer friendly point of view, I think it would be better to have addClass/toggleClass/hasClass rather than addClass/ toggleClass/is. Just my 2c ;) -- Sébastien Le 07-03-02 à 13:30, John Resig a écrit : give this a try: $(node).is(.class) --John On 3/2/07, Sébastien Pierre [EMAIL PROTECTED] wrote: Hi all, I was wondering if somebody would be interested in a hasClass(...) function for jQuery. I would definitely find it useful, and am willing to contribute it. -- Sébastien ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ -- -- Paul Bakaus ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Best practices for reattaching behaviours to dynamically loaded content?
I believe this is the easiest and simplest way to do it. On 3/4/07, Chris Domigan [EMAIL PROTECTED] wrote: I keep all my behaviours in separate functions. For instance if I had a fancy table widget I'd have a function called initTable() that contained the behaviour code. I'd call it initially upon page load, then call it again when necessary if content has been updated via ajax. Eg. $(document).ready() { initPage(); // misc page stuff that won't be refetched from ajax initTable(); initOtherStuff(); }); function initPage() { ... } function initTable() { ... } etc. Then if I need to refresh something in the table via ajax I just call initTable() in the callback of my ajax function. Chris ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ -- Joan Piedra || Frontend webdeveloper http://joanpiedra.com/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] ISO docs for $.fn ?
Hi Kynn - Documentation on $.extend can be found here: http://docs.jquery.com/JavaScript and information on using $.fn.extend can be found here: http://docs.jquery.com/Plugins/Authoring In jQuery $.fn.extend is used in plugin authoring, adding new methods to jQuery. The relationship in jQuery is like this: jQuery and $ are identical. jQuery.fn and $.fn are identical. jQuery.fn and jQuery.prototype are identical. jQuery.extend and jQuery.fn.extend are nearly identical, but when you pass in a single object of properties, jQuery.extend will extend the jQuery object with properties whereas jQuery.fn.extend will extend the jQuery.fn object (and thus add new methods to the jQuery core). All of that being said, if you're just getting started with jQuery, you're probably not going to have to worry about any of this. --John On 3/4/07, Kynn Jones [EMAIL PROTECTED] wrote: Hi. I'm just learning about jQuery and finding my way around its documentation. I have not been able to find any documentation on $.fn. In fact in some of the rest of the documentation (e.g. the example code for $.extend given at http://visualjquery.com/1.1.1.html, $.fn (or rather jQuery.fn ) without explanation. Actually, the examples given there raise many questions in my mind, for example: what's the difference between $.fn and jQuery.fn? And, what's the difference between calling jQuery.fn.extend and jQuery.extend? Are the answers to these questions in the documentation? If so, please point me to them. Any help would be much appreciated. TIA! kj ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Need some guidance...
http://bassistance.de/jquery-plugins/jquery-plugin-validation/ :) Rick Faircloth wrote: Alright... now I've got this working very well. The only problem I have now is validation. I normally submit a page back to itself, run some checks on the form values and throw up any errors messages before the form processes. However, with the function CalculateMortgage below, I can't do that. So I need some input on how to use jQuery for validation. Is there some info somewhere that will walk me through that? I need the following validation for form input: Principal: There must be an entry and it must be a number after all $ , . are taken out. Interest: There must be an entry and it must be a number after a % sign which might be entered is taken out. Years: There must be an entry and the entry must be numerical. Can anyone point me to some validation technique info that I could draw from? Thanks! Rick === Calc page: script type=text/javascript src=/js/jquery.js/script script type=text/javascript function CalculateMortgage(){ var Params = {}; // select all inputs of type text $(input:text).each(function(){ Params[$(this).attr(name)] = $(this).val(); }); // post the form. The Param object mimics form fields $.post(/path/to/yourdatapage.cfm, Params, function(data){ // this is the processing function. // append what you get back to the element with ID = Result after clearing its contents $(#Result).empty().append(data); } ); } /script form name=f table tr td align=rightstrongPrincipal:/strong/td tdinput type=text name=Principal/td /tr tr td align=rightstrongInterest Rate:/strong/td tdinput type=text name=InterestRate/td /tr tr td align=rightstrongDuration:/strong/td tdinput type=text name=Duration/td /tr tr td align=rightstrongResult:/strong/td tdspan id=Result/span/td /tr tr td align=rightnbsp;/td tdinput type=button value= Calculate onClick=CalculateMortgage();return false;/td /tr /table /form Page from which you are getting the data: cfsetting showdebugoutput=nocfset calc = form.Principal * form.InterestRate * form.Duration cfcontent reset=yescfoutput#DollarFormat(calc)#/cfoutput Rick Faircloth wrote: Hi, Daemach... Thanks for the guidance, but unfortunately, I'm still using CF 4.5, so CFC's are obviously not an option. I plan to upgrade this summer to CF 8 and catch up with everyone. I was looking over your code, too... that complicated stuff! (For someone just starting out, anyway...) After looking over the code, I can begin to see how it's being done... just wish I could use AjaxCFC! Thanks for your time and help! Rick -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Daemach Sent: Wednesday, February 28, 2007 6:00 PM To: discuss@jquery.com Subject: Re: [jQuery] Need some guidance... Hi Rick - This is one of those things I would use ajaxCFC for since it handles serialization automatically. The idea here is that you need to serialize the values of your form fields, send them to the server, deserialize, calculate and put the results into some kind of structure which gets serialized again and returned to the browser for processing which starts with deserializing. Dealing with the serialization/deserialization transparently is what makes ajaxCFC so great. First, download ajaxcfc here: http://www.robgonda.com/blog/projects/ajaxcfc/download.cfm in the zip file drill down to ajaxCFC/branches/jquery/core/. Put the .cfc's in some accessible folder on your web server, then copy everything inside the /js folder to your javascript repository - I create a subfolder to keep it separate: /js/ajaxCFC. That's it for the install. This sample code should get you started. I stuck the ajax call directly into the click event on the button, but you could put all of that in a separate function and then call the function from the click event handler if you want. === your html/cfm page with the calculator: script type=text/javascript src=/js/jquery.js/script script type=text/javascript src=/js/ajaxCFC/jquery.AjaxCFC.js/script script type=text/javascript // additional files $.AjaxCFC({require:'json'}); // more
Re: [jQuery] ISO docs for $.fn ?
All of that being said, if you're just getting started with jQuery, you're probably not going to have to worry about any of this. I should say, though, that if you're already digging into Plugin development, then scratch my statement! --John ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] ISO docs for $.fn ?
This info couldn't have been more timely for me, as soon as I started playing with jQuery my first reaction was to mix in my homebrew code. It was very easy, although now I'm trying to extend it and the distinctions you gave were great. One question though: is there a proper way to check for a preexisting member or method (other than typeof)? On 3/4/07, John Resig [EMAIL PROTECTED] wrote: All of that being said, if you're just getting started with jQuery, you're probably not going to have to worry about any of this. I should say, though, that if you're already digging into Plugin development, then scratch my statement! --John ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/