[jQuery] jQuery Form and jQuery UI Submission Problem
I'm trying to something that should be pretty simple: Open up a jquery-ui modal dialogue with a form in it. When the user submits the form, it shows the server output right there in the open dialogue. User closes it, and goes back to the screen where they just were. I can get it to pop the dialogue and show the form, but when you submit the form it submits it normally (doesn't use ajax/jquery.form to do it) Code: At the bottom of my main document: div id=download title=Download Template/div A random link on the page might look like this: javascript:download(1584) Download Here's the download function: function download( id ) { var cURL = '/templates/download/id/' + id + '/'; load_modal_dialog( cURL, download ); } And that load_modal_dialog() function: function load_modal_dialog( cURL, oTarget ) { $(# + oTarget).dialog({ autoOpen: false, modal: true, height: 350, width: 450, overlay: { opacity: 0.5, background: black } }); $(# + oTarget).dialog(open); $.ajax({ url: cURL, cache: false, success: function(html){ document.getElementById(oTarget).innerHTML = html; } }); } This works perfectly, it opens up the URL given which draws a form. Here's the exact HTML that it currently loads up: html head script type='text/javascript' language='javascript' src='/include/jquery.js'/script script type='text/javascript' language='javascript' src='/include/jquery.form.js'/script script type='text/javascript' $(document).ready(function() { var options = { target:'#outputdiv', // target element(s) to be updated with server response beforeSubmit: function() { document.body.style.cursor = 'wait'; }, // pre-submit callback success: function() { document.body.style.cursor = 'default'; } // post-submit callback }; // bind to the form's submit event $('#dlform').submit(function() { alert('submitting'); $(this).ajaxSubmit(options); return false; }); }); /script /head body div id='outputdiv' form id='dlform' action='$SCRIPT_NAME' method='post' table tr td eMail Address: input name='email_address' / /td td input type='submit' value='Download' / /td /tr /table input type='hidden' name='controller' value='files' / input type='hidden' name='action' value='download' / input type='hidden' name='id' value='$id' / /form /div /body /html As you can see, this is currently a full HTML page that reloads the jquery and jquery.form libraries, and does the binding for the form on the page. I've wrapped the form in the outputdiv, which is where I want the returning output from the server after the submit button is clicked to show up. Clicking the submit button just submits the form. The bind doesn't seem to work at all (It never alerts me). Now, if I were to load up the URL that is called by the download function all by itself (outside of the modal stuff), it works perfectly, just not from within the modal dialogue. I've tried this without the full html ... just the script and the form. I've tried binding to all forms ( using $('form') and I've even tried to load an iframe into the modal dialogue (but could never get it to display anything) I'm at a loss --- I'm sure someone has crossed this bridge already. I appreciate your assistance. -- View this message in context: http://www.nabble.com/jQuery-Form-and-jQuery-UI-Submission-Problem-tp20788490s27240p20788490.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] First steps in jQuery: trying to figure the syntax to mix standard Javascript with jQuery
Hello, Sorry if my question is not worded properly, I'm new to jQuery and still do not understand its syntax. I've read a lot of examples and it did not help me much. I've got this really simple JS function: function getActiveText(e) { var text = window.getSelection(); alert(text); } That returns the raw selection in an xhtml page. Now I want to limit what it returns to only what is enclosed in divs of the class selectable. jQuery has the $('div.selectable') selector which selects all div elements with a class name of selectable. What I'm missing is the glue code between my function and jQuery's selector. From there, I should be able to go further with jQuery. Now I'm just getting confused. Cheers, Stéphane -- View this message in context: http://www.nabble.com/First-steps-in-jQuery%3A-trying-to-figure-the-syntax-to-mix-standard-Javascript-with-jQuery-tp20790038s27240p20790038.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: First steps in jQuery: trying to figure the syntax to mix standard Javascript with jQuery
The glue code is converting your jQuery object. var text = $('div.selectable')[0].getSelection(); alert(text); [0] takes the first element you selected and removes the jQuery methods, replacing them with the usual DOM methods. I don't know how supported .getSelection() is so this code may not work. But you can do something similar like var text = $('div.selectable')[0].innerHTML; Now if you wanted to do this for all div.selectable, you could do: $('div.selectable').each(function() { var text = this.getSelection(); //or innerHTML or so on alert(text); }) On Dec 2, 6:04 am, stephane_r [EMAIL PROTECTED] wrote: Hello, Sorry if my question is not worded properly, I'm new to jQuery and still do not understand its syntax. I've read a lot of examples and it did not help me much. I've got this really simple JS function: function getActiveText(e) { var text = window.getSelection(); alert(text); } That returns the raw selection in an xhtml page. Now I want to limit what it returns to only what is enclosed in divs of the class selectable. jQuery has the $('div.selectable') selector which selects all div elements with a class name of selectable. What I'm missing is the glue code between my function and jQuery's selector. From there, I should be able to go further with jQuery. Now I'm just getting confused. Cheers, Stéphane -- View this message in context:http://www.nabble.com/First-steps-in-jQuery%3A-trying-to-figure-the-s... Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: how to avoid overhead
I would start by evaluating the requirement for adding 1599 divs. The way you have written it is probably the most efficent cross browser way of appending that much content but it will still crawl. On Dec 2, 10:53 am, Dirceu Barquette [EMAIL PROTECTED] wrote: Hi! The code: for (i = 0; i 1600 ;i ++) { htm += 'div/div';} $(htm).appendTo('#parentDiv'); How can avoid overhead? thanks, Dirceu Barquette
[jQuery] How to adapt Jquery Parser
Hi everyone, I would like to do some manipulation on Jquery Parser: http://projects.allmarkedup.com/jquery_url_parser/ but as I have always used it as regular I don't know how to modify this plugin. My purpose is to add a function that will add or set a new parameter: below is the code of the current plugin: In advance thanks [code] /* === * * JQuery URL Parser * Version 1.0 * Parses URLs and provides easy access to information within them. * * Author: Mark Perkins * Author email: [EMAIL PROTECTED] * * For full documentation and more go to http://projects.allmarkedup.com/jquery_url_parser/ * * --- * * CREDITS: * * Parser based on the Regex-based URI parser by Stephen Levithian. * For more information (including a detailed explaination of the differences * between the 'loose' and 'strict' pasing modes) visit http://blog.stevenlevithan.com/archives/parseuri * * --- * * LICENCE: * * Released under a MIT Licence. See licence.txt that should have been supplied with this file, * or visit http://projects.allmarkedup.com/jquery_url_parser/licence.txt * * --- * * EXAMPLES OF USE: * * Get the domain name (host) from the current page URL * jQuery.url.attr(host) * * Get the query string value for 'item' for the current page * jQuery.url.param(item) // null if it doesn't exist * * Get the second segment of the URI of the current page * jQuery.url.segment(2) // null if it doesn't exist * * Get the protocol of a manually passed in URL * jQuery.url.setUrl(http://allmarkedup.com/;).attr(protocol) // returns 'http' * */ jQuery.url = function() { var segments = {}; var parsed = {}; /** * Options object. Only the URI and strictMode values can be changed via the setters below. */ var options = { url : window.location, // default URI is the page in which the script is running strictMode: false, // 'loose' parsing by default key: [source,protocol,authority,userInfo,user,password,host,port,relative,path,directory,file,query,anchor], // keys available to query q: { name: queryKey, parser: /(?:^|)([^=]*)=?([^]*)/g }, parser: { strict: /^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*):?([^:@]*))?@)?([^: \/?#]*)(?::(\d*))?))??:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:# (.*))?)/, // more intuitive, fails on relative paths and deviates from specs loose: /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@] *):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?# \/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/ //less intuitive, more accurate to the specs } }; /** * Deals with the parsing of the URI according to the regex above. * Written by Steven Levithan - see credits at top. */ var parseUri = function() { str = decodeURI( options.url ); var m = options.parser[ options.strictMode ? strict : loose ].exec( str ); var uri = {}; var i = 14; while ( i-- ) { uri[ options.key[i] ] = m[i] || ; } uri[ options.q.name ] = {}; uri[ options.key[12] ].replace( options.q.parser, function ( $0, $1, $2 ) { if ($1) { uri[options.q.name][$1] = $2; } }); return uri; }; /** * Returns the value of the passed in key from the parsed URI. * * @param string key The key whose value is required */ var key = function( key ) { if ( ! parsed.length ) { setUp(); // if the URI has not been parsed yet then do this first... } if ( key == base ) { if ( parsed.port !== null parsed.port !== ) { return parsed.protocol+://+parsed.host+:+parsed.port+/; } else { return parsed.protocol+://+parsed.host+/; } } return ( parsed[key] === ) ? null : parsed[key]; }; /** * Returns the value of the required query string parameter. * * @param string item The parameter whose value is required */ var param =
[jQuery] Re: First steps in jQuery: trying to figure the syntax to mix standard Javascript with jQuery
Ryura wrote: The glue code is converting your jQuery object. var text = $('div.selectable')[0].getSelection(); alert(text); [0] takes the first element you selected and removes the jQuery methods, replacing them with the usual DOM methods. I don't know how supported .getSelection() is so this code may not work. But you can do something similar like var text = $('div.selectable')[0].innerHTML; Now if you wanted to do this for all div.selectable, you could do: $('div.selectable').each(function() { var text = this.getSelection(); //or innerHTML or so on alert(text); }) Hi, thanks for that. I understand slightly better how things work. Sorry about posting newbie questions, but I'm one of these 'bottom-up' guys who needs to see how things work under the hood before being able to focus on the docs. So this kind of explanation really, really helps me in my learning quest. (Answering to MorningZ too here, who I also thank for his links. :-)) As you feared, getSelection() will not work (document.getSelection() works, but replacing the 'document' by the jQuery object is a no-go. Using $('div.selectable').each(function() { var text = this.innerHTML; alert(text); }) sort of works, but it loses the 'selection' aspect (my script tries to return only what was selected with the mouse) and returns each div.selectable on the page, selected or not. Is there a way to emulate getSelection() in jQuery? (I guess the answer is yes.) Thanks for the kick start, Stéphane -- View this message in context: http://www.nabble.com/First-steps-in-jQuery%3A-trying-to-figure-the-syntax-to-mix-standard-Javascript-with-jQuery-tp20790038s27240p20791607.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: how to avoid overhead
Thank you!! please! see the example at isabeladraw.sourceforge.net. I've been forced build blocks against the entire board. But I'm thinking create child-by-child onmouseover position. sorry my english... Dirceu Barquette 2008/12/2 [EMAIL PROTECTED] [EMAIL PROTECTED] I would start by evaluating the requirement for adding 1599 divs. The way you have written it is probably the most efficent cross browser way of appending that much content but it will still crawl. On Dec 2, 10:53 am, Dirceu Barquette [EMAIL PROTECTED] wrote: Hi! The code: for (i = 0; i 1600 ;i ++) { htm += 'div/div';} $(htm).appendTo('#parentDiv'); How can avoid overhead? thanks, Dirceu Barquette
[jQuery] Re: Using jquery to construct menus like nbc.com
Dead on. I added a padding-bottom: 10px to the #nav ul li element to bridge the gap and that seems to have fixed it. Thanks again! Jeffrey Kretz wrote: Here's what I believe is happening. You have an LI that is a certain height, about 21px. This LI is inside a div that is larger, 36px. The floating DIVs are positioned underneath the larger DIV. --- MENU DIV LI - Empty space -- Floating Div There is an empty space between the LI and its child DIV. So when you move the mouse there, it is no longer inside the LI or its children, and it fires the mouseleave event. You could set the height of the LI to expand to the size of the menu DIV. JK -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of serpicolugnut Sent: Monday, December 01, 2008 4:52 PM To: jquery-en@googlegroups.com Subject: [jQuery] Re: Using jquery to construct menus like nbc.com I used your mouseenter and mouseleave function, but I'm still having issues with the menus disappearing when the user mouses off the top level item, and in to the lower level list items (containing the div menus). Here's a link to a more fleshed out example: http://dl.getdropbox.com/u/21984/menu_test_case/menu_test_case.html Any clues on why it's inconsistent in it's sticky-ness? Thanks - Ted Jeffrey Kretz wrote: I made a few changes and reposted it here: http://test1.scorpiondesign.com/LocalTest7.htm Changes: menu1 through menu5 were moved underneath their respective LIs. When the menus were NOT children of the LIs, the mouseenter mouseleave kept firing. #nav { position:relative; } This allows the absolute positioning of child elements relative to itself. #menu1, #menu2, #menu3, #menu4, #menu5 { display:none; left: 0px; Rather than hiding the menus with javascript, I set the CSS to display none. The first toggle called will turn them on. The left:0px aligns the menus with the first relatively positioned element, in this case #nav. $(li.main-nav).bind(mouseenter mouseleave, function(){ $(this).children('div').toggle(); return false; }); So it's a class based selector (less code), and it only binds the parent element (rather than the parent and child). Cheers, JK -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of serpicolugnut Sent: Tuesday, November 25, 2008 11:04 AM To: jquery-en@googlegroups.com Subject: [jQuery] Re: Using jquery to construct menus like nbc.com Here's a link to a simplified version of the code. The mouseenter/mouseleave events helped, but I'm seeing some strangeness on the first menu item, and then some flickering on the others. http://dl.getdropbox.com/u/21984/menu_test.html Jeffrey Kretz wrote: If you have a sample url of your code, that would be helpful. But at a guess, the flyout div is probably not a child of the main menu element, so the mouseenter and mouseleave won't work properly. If this is the case, it will require a minor change to the hover plumbing. The z-index with flash in IE6/7 can usually be solved by doing two things: 1. Add the wmode=transparent attribute to the flash movie. 2. Wrap the tag in a div set for the same width and height, with its z-index set for 0. JK -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of serpicolugnut Sent: Tuesday, November 25, 2008 7:08 AM To: jquery-en@googlegroups.com Subject: [jQuery] Using jquery to construct menus like nbc.com I'm trying to utilize jquery to construct a menu structure that is similar to what you see at fox.com and nbc.com. Basically I have a menu that is a ul list, with each li selector given it's own id. Below I have a div container for each menu item, which are set to be hidden by jquery upon load. I've been the mousever/mouseout actions to trigger turning each div container on/off, but the problems I'm encountering with this are 1) it works when hovering over the main menu selection, but not when the mouse is inside the div, making selecting sub items difficult/ impossible, and 2) for some reason in IE6/IE7, the divs don't show when they are over a Flash object. Does anybody have any ideas on how to take items #1 and #2? -- View this message in context: http://www.nabble.com/Using-jquery-to-construct-menus-like-nbc.com-tp2068217 1s27240p20682171.html Sent from the jQuery General Discussion mailing list archive at Nabble.com. -- View this message in context: http://www.nabble.com/Using-jquery-to-construct-menus-like-nbc.com-tp2068217 1s27240p20687612.html Sent from the jQuery General Discussion mailing list archive at Nabble.com. -- View this message in context:
[jQuery] Problem with Jquery tabs
I'm having an issue getting Jquery tabs to run correctly. I'm using the technique described at http://media.jqueryfordesigners.com/jquery-tabs-part2.mov . I've setup a test case here: http://dl.getdropbox.com/u/21984/menu_test_case/tab_test_case.html The tabs work as expected when they are clicked on, but upon initial load, all the tabs are displayed instead of the 1st one. Any ideas on why this isn't working quite as expected? -- View this message in context: http://www.nabble.com/Problem-with-Jquery-tabs-tp20792283s27240p20792283.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: clearcase error when trying to add jquery-1.2.6.min.js to source control
a little update on this. I still haven't figured out how to resolve the issue, but for now, someone pointed out to me that clearcase has problems with very long lines (more than 8000 characters). I am trying to use cleartool to specify the file type while adding the file. Will update once I get that working. On Dec 1, 2:45 pm, ksun [EMAIL PROTECTED] wrote: Today I tried adding jquery-1.2.6.min.js to source control (Rational ClrearCase). below is the error I got. I didn't get the error when I tried jquery-1.2.6.js. Anyone know why the minified version gives the error. I would like to use the minified version for the obvious reasons. I found some topics when googling this error about using binary type for the file. My understanding is that the minified file is a text file, I don't have any problem opening in DreamWeaver (it is definitely text) , Is clearcase thinking it is not a text file? Error Message : Type manager text_file_delta failed create_version operation. PS: I would rather not use Clearcase, but I am stuck with it at my current workplace. Thanks ksun
[jQuery] Re: Problem with Jquery tabs
Initialize the content tabs as hidden using class=ui-tabs-hide on the div tags Like: div id=TabContainer ul class=tabs li style=list-style-image: none;a href=#pane-1spanPane1/span/a/li li style=list-style-image: none;a href=#pane-2spanPane2/span/a/li li style=list-style-image: none;a href=#pane-3spanPane3/span/a/li /ul div id=pane-1 class=ui-tabs-hide Pane 1 Contents /div div id=pane-2 class=ui-tabs-hide Pane 2 Contents /div div id=pane-3 class=ui-tabs-hide Pane 3 Contents /div /div On Dec 2, 8:37 am, serpicolugnut [EMAIL PROTECTED] wrote: I'm having an issue getting Jquery tabs to run correctly. I'm using the technique described athttp://media.jqueryfordesigners.com/jquery-tabs-part2.mov. I've setup a test case here: http://dl.getdropbox.com/u/21984/menu_test_case/tab_test_case.html The tabs work as expected when they are clicked on, but upon initial load, all the tabs are displayed instead of the 1st one. Any ideas on why this isn't working quite as expected? -- View this message in context:http://www.nabble.com/Problem-with-Jquery-tabs-tp20792283s27240p20792... Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: Problem with Jquery tabs
put style=display:none on the content divs. serpicolugnut wrote: I'm having an issue getting Jquery tabs to run correctly. I'm using the technique described at http://media.jqueryfordesigners.com/jquery-tabs-part2.mov . I've setup a test case here: http://dl.getdropbox.com/u/21984/menu_test_case/tab_test_case.html The tabs work as expected when they are clicked on, but upon initial load, all the tabs are displayed instead of the 1st one. Any ideas on why this isn't working quite as expected?
[jQuery] Re: Problem with Jquery tabs
That works, but this line of code - $(tabContainers).hide().filter(this.hash).show(); ...is supposed to hide all the tabs and show the first tab upon execution. The cited example at jqueryfordesigners.com doesn't require you to manually hide the divs with css, the jquery code is supposed to do that. On Dec 2, 8:44 am, Liam Potter [EMAIL PROTECTED] wrote: put style=display:none on the content divs. serpicolugnut wrote: I'm having an issue getting Jquery tabs to run correctly. I'm using the technique described at http://media.jqueryfordesigners.com/jquery-tabs-part2.mov. I've setup a test case here: http://dl.getdropbox.com/u/21984/menu_test_case/tab_test_case.html The tabs work as expected when they are clicked on, but upon initial load, all the tabs are displayed instead of the 1st one. Any ideas on why this isn't working quite as expected?
[jQuery] Re: Double right-click, anyone?
Yes, you're right; there is no default event handler for double right- click. The code you introduced won't really simulate the double click; it will consider any two right-clicks a double click, which is not the wanted behaviour. Refer to the code above shared by Ricardo (http:// jsbin.com/iyegu/) for a sample... the timeout is something required to simulate a real double click. Thanks for sharing your thoughts :) On Dec 1, 6:36 pm, Andy Matthews [EMAIL PROTECTED] wrote: I don't think there's a default double right click event handler, but this wouldn't be that hard to write. Psuedo code --- $('#someElement').rightclick(function(){ totalClicks = 0; if (totalClicks == 2) { // do some stuff totalClicks = 0; } else { totalClicks++; } }); -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of TheBlueSky Sent: Saturday, November 29, 2008 6:21 AM To: jQuery (English) Subject: [jQuery] Double right-click, anyone? Hi everyone, Does anyone has code, implementation, plug-in or whatever to detect double right-click? I'm searching and trying for couple of days now without any result. Appreciate any help.- Hide quoted text - - Show quoted text -
[jQuery] [tooltip] Image preview choppy when switching from right to left side of mouse pointer?
I've implemented http://bassistance.de/jquery-plugins/jquery-plugin-tooltip/ plugin at this test page: http://www.randomjabber.com/test/logogala/gallery_tooltip.html. I think I've implemented it correctly, but I'm not completely sure of that? It seems to work like it should when you hover over the left two images in the left two columns. But, when you hover over the images in the right column and the image preview pops up to the left of the mouse pointer instead of to the right (since the margin of the browser window is there) the tracking seems to be a little choppy when you move your mouse around. Is this something I'm doing wrong? Is there something I can add to fix this or is it just the nature of the plugin? Thanks, Deron -- View this message in context: http://www.nabble.com/-tooltip--Image-preview-choppy-when-switching-from-right-to-left-side-of-mouse-pointer--tp20792886s27240p20792886.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: ask : jquery validation plugins not working
I have never used validation plugin before so excuse me if I'm wrong. But just looking at your code I don't see any element with householdBudgetForm id in your code (on which you are calling validate), the form id is BudgetForm On Dec 2, 5:16 am, Jörn Zaefferer [EMAIL PROTECTED] wrote: Could you provide a testpage? Jörn On Mon, Dec 1, 2008 at 10:32 PM, Adwin Wijaya [EMAIL PROTECTED] wrote: Hi jquery users, I have forms which has a lot of input inside and all of it I set as required. Actually I generated the form using database, not by hand :) each input has unique id (generated by server). at the moment, the validation wont work on all field, it just detect the first fields ... (eg: houseHoldExpfood, expPerson1food, expPerson2food) .. but ignored another fields. is this jquery validation bug ? here is My javascript code: $(document).ready(function(){ $('#householdBudgetForm').validate({ errorLabelContainer: $('#householdBudgetErrorMsg'), submitHandler: submitHouseholdBudgetForm }); }); here is my form : form action=/save method=post name=BudgetForm id=BudgetForm table width=100% thead tr thExpenses/th thSuggested exp/th thHousehold exp/th th%/th thPerson1/th thPerson2/th thReason/th /tr /thead tbodytr class=tr_even tdFood incl groceries take aways/td td 2,100 input type=hidden value=2100.00 id=suggestedExpfood name=suggestedExp/ /td tdinput type=text title=Please enter Expense for Food incl groceries amp; take aways myid=food value= id=houseHoldExpfood name=houseHoldExp size=10 class=money required houseHoldExp//td td span id=percentagefood/ /td td input type=text title=Please enter Expense Person 1 for Food incl groceries amp; take aways myid=food value= id=expPerson1food name=expPerson1 size=10 class=money required expPerson1/ /td td input type=text title=Please enter Expense Person 1 for Food incl groceries amp; take aways myid=food value= id=expPerson2food name=expPerson2 size=10 class=money required expPerson2/ /td td span style=margin: 0pt; padding: 0pt; class=reason id=reasonfood input type=hidden value= id=reasonfood name=reason/ a class=reasonLink myid=food id=reasonLinkfood href=#img src=/ilink/images/reason.png//a /span /td /tr tr class=tr_odd tdPhone mobile internet/td td 830 input type=hidden value=830.00 id=suggestedExpcommunication name=suggestedExp/ /td tdinput type=text title=Please enter Expense for Phone mobile internet myid=communication value= id=houseHoldExpcommunication name=houseHoldExp size=10 class=money required houseHoldExp//td td span id=percentagecommunication/ /td td input type=text title=Please enter Expense Person 1 for Phone mobile internet myid=communication value= id=expPerson1communication name=expPerson1 size=10 class=money required expPerson1/ /td td input type=text title=Please enter Expense Person 1 for Phone mobile internet myid=communication value= id=expPerson2communication name=expPerson2 size=10 class=money required expPerson2/ /td td span style=margin: 0pt; padding: 0pt; class=reason id=reasoncommunication input type=hidden value= id=reasoncommunication name=reason/ a class=reasonLink myid=communication id=reasonLinkcommunication href=#img src=/ilink/images/ reason.png//a /span /td /tr tr class=tr_even tdEntertainment, pay tv/td td 1,100 input type=hidden value=1100.00 id=suggestedExpentertainment name=suggestedExp/ /td tdinput type=text title=Please enter Expense for Entertainment, pay tv myid=entertainment value= id=houseHoldExpentertainment name=houseHoldExp size=10 class=money required houseHoldExp//td td span id=percentageentertainment/ /td td input type=text title=Please enter Expense Person 1 for Entertainment, pay tv myid=entertainment value= id=expPerson1entertainment name=expPerson1 size=10 class=money required expPerson1/ /td td input type=text title=Please enter Expense
[jQuery] how to check if a form has changed
Hi, we are trying to give a feedback to the user if the user has changed some values in the form and tries to close the form with out saving the changes. is there a plug-in that can check this? or do I have to loop-through each control and check if the value has changed by comparing the value with the stored value in a hidden variable? If there is a standard way to do this, please let me know. we are using asp.net to create the forms Thanks, sridhar.
[jQuery] Re: Problem with Jquery tabs
Plus, it doesn't work in either IE6/IE7. :,( serpicolugnut wrote: I'm having an issue getting Jquery tabs to run correctly. I'm using the technique described at http://media.jqueryfordesigners.com/jquery-tabs-part2.mov . I've setup a test case here: http://dl.getdropbox.com/u/21984/menu_test_case/tab_test_case.html The tabs work as expected when they are clicked on, but upon initial load, all the tabs are displayed instead of the 1st one. Any ideas on why this isn't working quite as expected? -- View this message in context: http://www.nabble.com/Problem-with-Jquery-tabs-tp20792283s27240p20793052.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: Ajax to return more values
That's a good point, but in my case I will stick with regex. Another idea is to use multiple top html elements (divs for example) and then query for values of div you want. On Dec 1, 6:11 pm, Andy Matthews [EMAIL PROTECTED] wrote: If you're using a 3rd party JSON library, then you'd just pass in whatever language construct you've got and let the library encode for you. andy -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of me-and-jQuery Sent: Monday, December 01, 2008 11:04 AM To: jQuery (English) Subject: [jQuery] Ajax to return more values Ho-ho-ho. I wonder what is the best practice if I want to get 2 or three values back to function with ajax. The last value would be lots of html code and first two kind of state values (number or short string). I don't like jSON a lot, since you need to return one-line response and you must be careful with a shape ( and }). Second option is having a regex to fetch first two values and all remaining is a third value. And what do you think is the best solution here? Happy December, me-and-jQuery
[jQuery] Re: treeview pluging issues - .find(.hitarea)
hello there... like that you have added add and delete nodes how would i get a json data object to create the initial tree ? thanks! On Wed, Nov 26, 2008 at 1:15 PM, Dirceu Barquette [EMAIL PROTECTED] wrote: You are welcome!! :D 2008/11/26 alextait [EMAIL PROTECTED] thanks very much! :) On Nov 24, 4:12 am, Dirceu Barquette [EMAIL PROTECTED] wrote: Hi alextait, there is a new release for jqtreeview plugin at: http://downloads.sourceforge.net/jqtreevial/jqtreevial-pack-0.3.zip I've added insert and delete methods. Dirceu Barquette 2008/11/21 alextait [EMAIL PROTECTED] I have taken a look at your plugin... that fantastic! Unfortunately it does not seem to do what i need. Since our category/product data is so huge... I am trying to create a tree that will populate the child nodes only when the parent node is clicked. Once loaded into the dom the user can collapse or expand nodes using jquery. Will continue trying to get the treeview code to work for now. thanks very much for your help! :) On 20 Nov, 16:32, Dirceu Barquette [EMAIL PROTECTED] wrote: Hi, seehttp://sourceforge.net/projects/jqtreevial/ I've been developing this plugin. Not complete yet, but is functional. Dirceu 2008/11/20 alextait [EMAIL PROTECTED] I am fairly new to jquery and I am trying to create a product/category browser/tree using the treeview plugin and ajax. My first simple issue is this peice of code i am trying to understand. .find(.hitarea) what is happening here ? I understand the find functino but not sure about the chevron usage ? the overall problem is this. On viewing my list. if i click on one of the initial categories the second sub categories show up fine. I can then contract this sub list if i wish. If i leave this open and click on one of the sub categories for some reason i cannot then contract it again. I have looked into the treeview plugin code and found that the toggler method which would normaly just contract the list branch fires twice causing it to hide again. If anyone has any idea on thie general problem that would be great. thanks for any help in advance -- Alex Tait
[jQuery] Selecting only partial text from div
I've a div which has lot of contents inside it... I need to display only text of length less than 100letters..anything more should be displayed only when I point to the word after it For example: divThis is the 100th word this is/div Here when I move my mouse from 'T' in This to 'h' in 100th I need to display This is the 100th and when I move my cursor to 'w' in word - I need to get word this is I heard about using mouse position to get this but I don't know how. Komin
[jQuery] UI/Resizable
hi I applied the resize option to resize a textarea's height while the width should be dynamic (100%), so if the user resizes the browser window the textarea changes it's size. The default behavior seams to be that the width changes to a fixed value. Anyone an idea how to change that? thanks for any hints $(.resize-y).resizable({ handles: s,e, preventDefault: true }); nos
[jQuery] Treeview
I've been having some problems implementing a simple treeview. In firefox or chrome the animation renders very quickly, but in IE 7 any expansion or contraction is slow and choppy at best. I've found that the culprit seems to be that the page's background is a 1px wide gradient (gif) that is repeated horizontally. If I take out the background then it renders perfectly in IE. Any help making IE behave better would be much appreciated. Thanks, Nick
[jQuery] Re: jQuery Treeview 1.4 by Joern Zaefferer
My problem may have been that I was using Treeview pre-1.4.1. Treeview 1.4 is used for Sample 0. Still need to test it with 1.4. On Dec 1, 7:48 pm, onelesscar [EMAIL PROTECTED] wrote: I noticed a new example on the demo page, Sample 0 - navigation I'll try this at home. With my change, it looked like it worked - the link appeared to be loaded when clicked, and the subfolders expanded. However, when I made real pages available to the parent folder link, only the link loaded - the subfolders were NOT expanded. Hopefully Sample 0 is the right fix. thanks! On Dec 1, 7:36 pm, onelesscar [EMAIL PROTECTED] wrote: I'd like this as an option too. I was able to change the jquery.treeview.js script to make the link that is a folder load, but then the tree is not affected (the subfolders do not open). Note that I CAN expand the subfolders by clicking the little + box. Can I extend the hitarea to include the + box AND the folder link? There's a lot attached to the click event already and I'm not sure where to make the change. Thanks for a great jquery plug! Mark On Oct 27, 4:31 pm, Cruizer [EMAIL PROTECTED] wrote: Thanks for looking into this. Here is what you requested. I took your original demo page, removed demos 1 3 and modified Demo 2. I added collapsed: true and changed the persist to location in the demo.js file. Folder 1 has been linked to index.html, Folder 2 has been linked to # and Folder 3 has been linked to folder3.html. As you will notice, when you click on the text for Folders 1 3 it will take you to the HTML page, but it will not open the sub folders. If you click on either side, but not the text, it will open the sub folders, but not take you to the page. My understanding is that when you click on the word, it will take you to the page AND open the sub folders. If I am incorrect about this, please let me know. http://radtke.cgsart.com/v7.0/test/demo/index.html Thanks! Brent On Oct 27, 3:43 am, Jörn Zaefferer [EMAIL PROTECTED] wrote: Can't find anything obvious. Could you provide a stripped down testpage that shows the issue but contains only a very basic tree and nothing else? Jörn On Thu, Oct 23, 2008 at 10:29 PM, Cruizer [EMAIL PROTECTED] wrote: I am using this menu for a clients website, and I am having some problems with functionality. I may be reading it wrong, but in the documentation under persist: 'location' it states looks within all tree nodes with link anchors that match the document's current URL (location.href), and if found, expands that node (including its parent nodes). I am under the impression that when I create a URL for a menu item, when clicked it will expand the sub-menu's under that menu item, as well as directing you to the appropriate URL. This is where I am having the problem, it does not expand that menu item to expose the sub menu's when the menu item is a URL When you create the menu item as href=# it works fine, but obviously doesn't take you to the appropriate URL page. If the URL is href=something.html or href=something.php it doesn't work. It starts to expand the menu, then closes right up. To see an example of what I am speaking of, please go to the foloowing website. There click on services, then Engineering. Engineering will take you to a new page but the sub menu's won't show until you click one of the links on the engineering page itself. http://radtke.cgsart.com/v7.0/index.php I thought this might have been a problem related to Persist: location but when I removed that from the .js, the problem still existed. Thanks!- Hide quoted text - - Show quoted text -
[jQuery] Re: Question from a Beginner - Creating DIVs on the fly, class-triggered events not working
Take a look at this: http://docs.jquery.com/Frequently_Asked_Questions#Why_doesn.27t_an_event_work_on_a_new_element_I.27ve_created.3F That contains a short answer to your question: Events are bound only to elements that exist when you issue the jQuery call. When you create a new element, you must rebind the event to it. The longer answer and a couple of workarounds can be found here: http://docs.jquery.com/Frequently_Asked_Questions#Why_do_my_events_stop_working_after_an_AJAX_request.3F - Richard On Mon, Dec 1, 2008 at 11:41 PM, dave [EMAIL PROTECTED] wrote: Hey all, I have just started using JQuery and have come across a hurdle. I am creating DIVs on the fly (using a JQuery). For these DIVs, I have them tagged to a Class. For this Class, I have an Event tied to it. For some reason, the Event doesn't seem to work for the newly created DIVs. However, it works for the hard-coded DIVs. Here's an example of what I mean. I'm using a Javascript to create the DIVs on the fly. e.g. function createDiv() { var divHtml = $(#existingDivs).html(); $(#existingDivs).html( divHtml + div class=classTiedToEventClassTiedtoEvent class test/ div ); } I then have an Event tied to the class, classTiedToEvent, like so... e.g. $(document).ready(function(){ $(div).click(function(){ if ( $(this).hasClass(classTiedToEvent) ) $(this).animate({ left: -10 }, 75) .animate({ left: 10 }, 75) .animate({ left: -10 }, 75) .animate({ left: 10 }, 75) .animate({ left: 0 }, 75); }); }); or... e.g. $(document).ready(function(){ $(.classTiedToEvent).click( function() { alert(clicked); } ); }); I've tried variations of the 2 above functions and neither have worked. However, they do work if I were to hardcode the classTiedToDiv DIV in my HTML. The DIVs that I generate with my first Javascript function (createDiv) do have the correct Class associated with them (I think), because they take on the attributes I've defined in my stylesheet. Any ideas what I'm doing wrong? Please let me know if you'd like me to clarify. Thanks. Dave
[jQuery] Re: First steps in jQuery: trying to figure the syntax to mix standard Javascript with jQuery
For: what is enclosed in divs of the class selectable http://docs.jquery.com/Attributes/html $('div.selectable').html() or http://docs.jquery.com/Attributes/text $('div.selectable').text() you may need to loop through them () if there are more than one http://docs.jquery.com/Core/each#callback Getting started? Seriously, the docs are a great great place to start :-) On Dec 2, 6:04 am, stephane_r [EMAIL PROTECTED] wrote: Hello, Sorry if my question is not worded properly, I'm new to jQuery and still do not understand its syntax. I've read a lot of examples and it did not help me much. I've got this really simple JS function: function getActiveText(e) { var text = window.getSelection(); alert(text); } That returns the raw selection in an xhtml page. Now I want to limit what it returns to only what is enclosed in divs of the class selectable. jQuery has the $('div.selectable') selector which selects all div elements with a class name of selectable. What I'm missing is the glue code between my function and jQuery's selector. From there, I should be able to go further with jQuery. Now I'm just getting confused. Cheers, Stéphane -- View this message in context:http://www.nabble.com/First-steps-in-jQuery%3A-trying-to-figure-the-s... Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] how could I select the applet node in jquery
currently I have a applet node with random names and ids everytime in my velocity page. I wonder if we have some selectors to select this element
[jQuery] Re: finding script tags in remote HTML
I'm using jQuery AJAX to recursively spider a website to build a sitemap.xml file. I'll acknowledge that this is an ass backwards method for building a sitemap, but let's put aside that issue. My issue is that I'd like to be able to parse anchors in each page, but not execute the JavaScript on the page. The pseudo code looks something like: var makeRequest = function(link) { $.get(link, {}, function(html){ $(a, html).each(function(){ makeRequest($(this).attr(href)); }); }); } $(a).each(function(){ makeRequest($(this).attr(href)); }); My problem is that when I do $(a, html), the html is executed (DOM?) and IE complains about JavaScript errors. My question is can I prevent the JS from being executed, external resources from being loaded (img, css) but still get the anchors for each page? - jake On Thu, Nov 6, 2008 at 1:01 PM, axemonkey [EMAIL PROTECTED] wrote: Hi all. I'm having an amazing amount of pain trying to parse and execute JS script blocks in remote HTML (in IE, typically). Here's the code in question: $.ajax({ type: POST, url:checkFilename, dataType: text, success:function(src){ var wtf = $(src).find(script).each(function(){ eval( $(this).text() ); }); } }); http://www.pastie.org/308878 checkFilename is just an HTML file, so src comes back with the entire source of that page. What I want to do then is use find() to get all inline script tags inside the body of the page, and use eval()* to run them. Elsewhere before this happens a large chunk of HTML from checkFilename is loaded and displayed, and now I need to run any inline JS that was in the page. The above function works perfectly in FF2 and FF3, but IE completely fails to find any instances of script tags in src. Any ideas? I can't extract the inline JS blocks in question, as they are dynamic and inserted by a CMS that I have no control over. Thanks in advance, --Clive. * I know it's evil, but I need it in this instance...
[jQuery] Re: finding script tags in remote HTML
Whoops, not trying to top post, but I believe our threads are related, in that we're both processing HTML from an AJAX request. Sorry, - jake On Tue, Dec 2, 2008 at 10:08 AM, Jake McGraw [EMAIL PROTECTED] wrote: I'm using jQuery AJAX to recursively spider a website to build a sitemap.xml file. I'll acknowledge that this is an ass backwards method for building a sitemap, but let's put aside that issue. My issue is that I'd like to be able to parse anchors in each page, but not execute the JavaScript on the page. The pseudo code looks something like: var makeRequest = function(link) { $.get(link, {}, function(html){ $(a, html).each(function(){ makeRequest($(this).attr(href)); }); }); } $(a).each(function(){ makeRequest($(this).attr(href)); }); My problem is that when I do $(a, html), the html is executed (DOM?) and IE complains about JavaScript errors. My question is can I prevent the JS from being executed, external resources from being loaded (img, css) but still get the anchors for each page? - jake On Thu, Nov 6, 2008 at 1:01 PM, axemonkey [EMAIL PROTECTED] wrote: Hi all. I'm having an amazing amount of pain trying to parse and execute JS script blocks in remote HTML (in IE, typically). Here's the code in question: $.ajax({ type: POST, url:checkFilename, dataType: text, success:function(src){ var wtf = $(src).find(script).each(function(){ eval( $(this).text() ); }); } }); http://www.pastie.org/308878 checkFilename is just an HTML file, so src comes back with the entire source of that page. What I want to do then is use find() to get all inline script tags inside the body of the page, and use eval()* to run them. Elsewhere before this happens a large chunk of HTML from checkFilename is loaded and displayed, and now I need to run any inline JS that was in the page. The above function works perfectly in FF2 and FF3, but IE completely fails to find any instances of script tags in src. Any ideas? I can't extract the inline JS blocks in question, as they are dynamic and inserted by a CMS that I have no control over. Thanks in advance, --Clive. * I know it's evil, but I need it in this instance...
[jQuery] JavaScript multithreading issues, race conditions, critical sections
Hi List, My question is not specific to jQuery and I don't wanna be offtopic, but I post there because I think there are the brightest minds of the planet regarding JavaScript development. We're building a web2.0 application and there are some singleton objects and various AJAX event handlers that manipulate them. I'm worried that race conditions can occur which have a potential to kill the client side. http://www.developer.com/lang/jscript/article.php/3592016 - This is the most relevant article that I could find about avoiding race conditions in JavaScript, but I'm not really confident about its content and there's very little information accessible on multithreaded issues regarding JavaScript. So basically I'd like to get some clarifications on whether JavaScript is multithreaded and if so, how one can build rock solid code that don't mess up the client side. Thanks in advance, Laci http://monda.hu
[jQuery] Just wondering if everyone saw this headline this morning...
*Microsoft embraces open source with jQuery* http://ct.techrepublic.com.com/clicks?t=72798576-42149c242d5f5fe2baa82f196da90399-bfbrand=TECHREPUBLICs=5 Microsoft plans to integrate the JQuery library into both the ASP.NET Web Forms and ASP.NET Model View Controller frameworks. Tony Patton outlines how jQuery may work within an ASP.NET application. This came in my TechRepublic enewsletter for Web Developers this morning... Rick
[jQuery] Re: Date validation issue on Safari [validate]
The date method just uses the native Date object to check for a valid date. Depending on your application, you should probably write your own date validation method - take a look at the existing methods for a reference. Documentation for writing custom methods is here: http://docs.jquery.com/Plugins/Validation/Validator/addMethod Jörn On Tue, Dec 2, 2008 at 6:24 AM, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi , First of all, Thanks for an awesome validation plugin :D I've used bassistance.de validation plugin version 1.4 and 1.5 and it's working fine on IE and Firefox. Just recently I've found that date validation isn't working properly on Safari. On Safari, it seems it's validated against American date format, so if I type in 10/02/2008 this is valid, but 14/02/2008 is invalid and it throw an error and won't let me submit the form. There's no problem on IE and Firefox, 14/02/2008 is valid and the form can be submitted. Anybody have this same problem? Any way around it? Thanks Be
[jQuery] with out ready event
Hi, Can we write any code out of $(document).ready(); Thanks Waiting 4 reply.
[jQuery] Re: Just wondering if everyone saw this headline this morning...
And is also two month plus old news TechRepublic isn't exactly speedy in keeping up with programming happenings On Dec 2, 10:16 am, Rick Faircloth [EMAIL PROTECTED] wrote: *Microsoft embraces open source with jQuery* http://ct.techrepublic.com.com/clicks?t=72798576-42149c242d5f5fe2baa8... Microsoft plans to integrate the JQuery library into both the ASP.NET Web Forms and ASP.NET Model View Controller frameworks. Tony Patton outlines how jQuery may work within an ASP.NET application. This came in my TechRepublic enewsletter for Web Developers this morning... Rick
[jQuery] Question from a Beginner - Creating DIVs on the fly, class-triggered events not working
Hey all, I have just started using JQuery and have come across a hurdle. I am creating DIVs on the fly (using a JQuery). For these DIVs, I have them tagged to a Class. For this Class, I have an Event tied to it. For some reason, the Event doesn't seem to work for the newly created DIVs. However, it works for the hard-coded DIVs. Here's an example of what I mean. I'm using a Javascript to create the DIVs on the fly. e.g. function createDiv() { var divHtml = $(#existingDivs).html(); $(#existingDivs).html( divHtml + div class=classTiedToEventClassTiedtoEvent class test/ div ); } I then have an Event tied to the class, classTiedToEvent, like so... e.g. $(document).ready(function(){ $(div).click(function(){ if ( $(this).hasClass(classTiedToEvent) ) $(this).animate({ left: -10 }, 75) .animate({ left: 10 }, 75) .animate({ left: -10 }, 75) .animate({ left: 10 }, 75) .animate({ left: 0 }, 75); }); }); or... e.g. $(document).ready(function(){ $(.classTiedToEvent).click( function() { alert(clicked); } ); }); I've tried variations of the 2 above functions and neither have worked. However, they do work if I were to hardcode the classTiedToDiv DIV in my HTML. The DIVs that I generate with my first Javascript function (createDiv) do have the correct Class associated with them (I think), because they take on the attributes I've defined in my stylesheet. Any ideas what I'm doing wrong? Please let me know if you'd like me to clarify. Thanks. Dave
[jQuery] Re: [tooltip] Image preview choppy when switching from right to left side of mouse pointer?
You could set a fixed with for the tooltip. That should improve the positioning. Jörn On Tue, Dec 2, 2008 at 3:08 PM, deronsizemore [EMAIL PROTECTED] wrote: I've implemented http://bassistance.de/jquery-plugins/jquery-plugin-tooltip/ plugin at this test page: http://www.randomjabber.com/test/logogala/gallery_tooltip.html. I think I've implemented it correctly, but I'm not completely sure of that? It seems to work like it should when you hover over the left two images in the left two columns. But, when you hover over the images in the right column and the image preview pops up to the left of the mouse pointer instead of to the right (since the margin of the browser window is there) the tracking seems to be a little choppy when you move your mouse around. Is this something I'm doing wrong? Is there something I can add to fix this or is it just the nature of the plugin? Thanks, Deron -- View this message in context: http://www.nabble.com/-tooltip--Image-preview-choppy-when-switching-from-right-to-left-side-of-mouse-pointer--tp20792886s27240p20792886.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: how to check if a form has changed
Just like what the groups here on Google use, you can use the JavaScript event onBeforeUnload to look for changes http://www.google.com/search?q=javascript+onbeforeunload On Dec 2, 9:15 am, Sridhar [EMAIL PROTECTED] wrote: Hi, we are trying to give a feedback to the user if the user has changed some values in the form and tries to close the form with out saving the changes. is there a plug-in that can check this? or do I have to loop-through each control and check if the value has changed by comparing the value with the stored value in a hidden variable? If there is a standard way to do this, please let me know. we are using asp.net to create the forms Thanks, sridhar.
[jQuery] how to avoid overhead
Hi! The code: for (i = 0; i 1600 ;i ++) { htm += 'div/div'; } $(htm).appendTo('#parentDiv'); How can avoid overhead? thanks, Dirceu Barquette
[jQuery] Re: jquery.timepickr.js: first official release
Obviously the iPhone doesn't have mouse over events, so for this to work it would need to be able to be clicked in environments where there is no mouse. I think its a really nice plugin though, intuitive and good looking. Well done! On Nov 13, 5:52 am, h3 [EMAIL PROTECTED] wrote: Thanks a lot, I've commited the fix. Unfortunately there is still some errors, at least we're closer .. I hope. On Nov 11, 10:17 am, Jeffrey Kretz [EMAIL PROTECTED] wrote: Look terrific in FF, but it's seriously broken in IE7. I get a script error on line 8007 whenever I click on the page, which seems to prevent anything from working. // hide all levels hide: function() { self = this; Right here. setTimeout(function() { self.wrapper.find('ol').hide(); }, self.options.hideDelay); }, It needs to say var self = this; It's trying to assign the global scope (window) object itself, and in IE, window.self is a read-only value, so it breaks. JK -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of h3 Sent: Tuesday, November 11, 2008 6:35 AM To: jQuery (English) Subject: [jQuery] [ANNOUNCEMENT] jquery.timepickr.js: first official release Hi everyone, Yesterday I released the first public release of my jquery.timepickr plugin. I've posted it on the jQuery plugin page:http://plugins.jquery.com/project/jquery-timepickr Home page:http://haineault.com/media/jquery/ui-timepickr/page/
[jQuery] IE7 jquery lightbox issue
I have used Lightbox and it works well in all browsers on my locale machine. But when I upload it on server for first time I can see click Next but from there onwards Next button appears right below to close button. Please let me know if there is any solution. URL: http://creativevisa.net/ver3/index.htm
[jQuery] Re: ask : jquery validation plugins not working
Could you provide a testpage? Jörn On Mon, Dec 1, 2008 at 10:32 PM, Adwin Wijaya [EMAIL PROTECTED] wrote: Hi jquery users, I have forms which has a lot of input inside and all of it I set as required. Actually I generated the form using database, not by hand :) each input has unique id (generated by server). at the moment, the validation wont work on all field, it just detect the first fields ... (eg: houseHoldExpfood, expPerson1food, expPerson2food) .. but ignored another fields. is this jquery validation bug ? here is My javascript code: $(document).ready(function(){ $('#householdBudgetForm').validate({ errorLabelContainer: $('#householdBudgetErrorMsg'), submitHandler: submitHouseholdBudgetForm }); }); here is my form : form action=/save method=post name=BudgetForm id=BudgetForm table width=100% thead tr thExpenses/th thSuggested exp/th thHousehold exp/th th%/th thPerson1/th thPerson2/th thReason/th /tr /thead tbodytr class=tr_even tdFood incl groceries take aways/td td 2,100 input type=hidden value=2100.00 id=suggestedExpfood name=suggestedExp/ /td tdinput type=text title=Please enter Expense for Food incl groceries amp; take aways myid=food value= id=houseHoldExpfood name=houseHoldExp size=10 class=money required houseHoldExp//td td span id=percentagefood/ /td td input type=text title=Please enter Expense Person 1 for Food incl groceries amp; take aways myid=food value= id=expPerson1food name=expPerson1 size=10 class=money required expPerson1/ /td td input type=text title=Please enter Expense Person 1 for Food incl groceries amp; take aways myid=food value= id=expPerson2food name=expPerson2 size=10 class=money required expPerson2/ /td td span style=margin: 0pt; padding: 0pt; class=reason id=reasonfood input type=hidden value= id=reasonfood name=reason/ a class=reasonLink myid=food id=reasonLinkfood href=#img src=/ilink/images/reason.png//a /span /td /tr tr class=tr_odd tdPhone mobile internet/td td 830 input type=hidden value=830.00 id=suggestedExpcommunication name=suggestedExp/ /td tdinput type=text title=Please enter Expense for Phone mobile internet myid=communication value= id=houseHoldExpcommunication name=houseHoldExp size=10 class=money required houseHoldExp//td td span id=percentagecommunication/ /td td input type=text title=Please enter Expense Person 1 for Phone mobile internet myid=communication value= id=expPerson1communication name=expPerson1 size=10 class=money required expPerson1/ /td td input type=text title=Please enter Expense Person 1 for Phone mobile internet myid=communication value= id=expPerson2communication name=expPerson2 size=10 class=money required expPerson2/ /td td span style=margin: 0pt; padding: 0pt; class=reason id=reasoncommunication input type=hidden value= id=reasoncommunication name=reason/ a class=reasonLink myid=communication id=reasonLinkcommunication href=#img src=/ilink/images/ reason.png//a /span /td /tr tr class=tr_even tdEntertainment, pay tv/td td 1,100 input type=hidden value=1100.00 id=suggestedExpentertainment name=suggestedExp/ /td tdinput type=text title=Please enter Expense for Entertainment, pay tv myid=entertainment value= id=houseHoldExpentertainment name=houseHoldExp size=10 class=money required houseHoldExp//td td span id=percentageentertainment/ /td td input type=text title=Please enter Expense Person 1 for Entertainment, pay tv myid=entertainment value= id=expPerson1entertainment name=expPerson1 size=10 class=money required expPerson1/ /td td input type=text title=Please enter Expense Person 1 for Entertainment, pay tv myid=entertainment value= id=expPerson2entertainment name=expPerson2 size=10 class=money required expPerson2/ /td td span style=margin: 0pt; padding: 0pt; class=reason id=reasonentertainment input type=hidden value= id=reasonentertainment name=reason/ a class=reasonLink myid=entertainment
[jQuery] Re: UI/Resizable
In order to make the textarea resizable, the plugin wraps it in a div which takes on it's computed outerWidth and outerHeight (in pixels), regardless of what is set as width and height (in your case a percentage). A workaround is to add .parent().width('100%') after the .resizable() call. This would only let you leave the width as a percentage and not have the width be user-resizable (you would change handles to 's' instead of 's,e'). Resizables doesn't currently support percentage resizing, but you can request the feature by entering a feature/enhancement ticket here: http://ui.jquery.com/bugs/newticket (note: requires registration) Also, in the future, should you have any other questions, there is a dedicated jQuery UI mailing list: http://groups.google.com/group/jquery-ui/ - Richard On Tue, Dec 2, 2008 at 5:13 AM, nos [EMAIL PROTECTED] wrote: hi I applied the resize option to resize a textarea's height while the width should be dynamic (100%), so if the user resizes the browser window the textarea changes it's size. The default behavior seams to be that the width changes to a fixed value. Anyone an idea how to change that? thanks for any hints $(.resize-y).resizable({ handles: s,e, preventDefault: true }); nos
[jQuery] Re: Horizontal scroll of lists with differing widths
Hi there John, Thanks for sending me that link. It does look really good. The only issue for me is it doesn't work with Javascript turned off. Accessibility is one of the main issues for the site I am currently working on, so I can't have it not work with Javscript turned off unfortunately. All I really need the Javscript to do is check how many LI's are inside the DIV then stretch the width of the container UL to stretch it out, thus getting horizontal scroll when scripts are turned on and vertical scroll when they're not. Anyway, thanks again for your help. Paul 2008/12/1 John Ruffin [EMAIL PROTECTED]: Paul, I found this interesting. Got it working in no time. If you are going to have a play with it just make sure you use the min and max attributes. It's documented in the blog. http://jqueryfordesigners.com/demo/slider-gallery.html -Original Message- From: Paul Collins [mailto:[EMAIL PROTECTED] Sent: Monday, December 1, 2008 12:07 PM To: jquery-en@googlegroups.com Subject: [jQuery] Horizontal scroll of lists with differing widths Hi all, Just wondering if someone could point me in the right direction for finding this code. Basically, I have a list which could contain 1-6 images. When there are four or more images, I would like to add a horizontal scrollbar to the content. I don't want to do this using CSS as I would need to add the full width to the list regardless of the amount of images. I would like to not have scrolling if there are less than four images. I have taken a look at jScrollPane, but this doesn't seem to support the dynamically changing widths of the list. Would really appreciate any help or direction! Thanks Paul
[jQuery] Date validation issue on Safari [validate]
Hi , First of all, Thanks for an awesome validation plugin :D I've used bassistance.de validation plugin version 1.4 and 1.5 and it's working fine on IE and Firefox. Just recently I've found that date validation isn't working properly on Safari. On Safari, it seems it's validated against American date format, so if I type in 10/02/2008 this is valid, but 14/02/2008 is invalid and it throw an error and won't let me submit the form. There's no problem on IE and Firefox, 14/02/2008 is valid and the form can be submitted. Anybody have this same problem? Any way around it? Thanks Be
[jQuery] Re: how to check if a form has changed
Try this http://www.4guysfromrolla.com/demos/OnBeforeUnloadDemo3.htm Cheers Marco Antonio On 12/2/08, Sridhar [EMAIL PROTECTED] wrote: Hi, we are trying to give a feedback to the user if the user has changed some values in the form and tries to close the form with out saving the changes. is there a plug-in that can check this? or do I have to loop-through each control and check if the value has changed by comparing the value with the stored value in a hidden variable? If there is a standard way to do this, please let me know. we are using asp.net to create the forms Thanks, sridhar.
[jQuery] Re: Can find() return elements in DOM order?
Thanks for the plugin, Ricardo. It works great in FF3 and IE7, but it doesn't work in Chrome. For my current needs, using the selector :input provides the form input controls in the dom order. var first_form_control = $('form#myform').find(':input').eq(0); Thanks for the help and suggestions. :) -Hector On Mon, Dec 1, 2008 at 7:13 PM, brian [EMAIL PROTECTED] wrote: looks good! $('#myform').find('input,select,textarea').sort(); On Mon, Dec 1, 2008 at 9:09 PM, ricardobeat [EMAIL PROTECTED] wrote: Here's a kind of 'DOM order sort plugin' I just made adapting code from the 'getElementsByTagNames' function by Peter-Paul Koch (http:// www.quirksmode.org/dom/getElementsByTagNames.html). I haven't tested it anywhere besides FF3. Just use it as: $('div,span').sort() (function($){ $.fn.sort = function(){ var arr = $.makeArray(this), firstNode = this[0]; if (firstNode.sourceIndex) { arr.sort(function (a,b) { return a.sourceIndex - b.sourceIndex; }); } else if (firstNode.compareDocumentPosition) { arr.sort(function (a,b) { return 3 - (a.compareDocumentPosition(b) 6); }); }; return $(arr); }; })(jQuery); I'd appreciate some feedback if this works :] - ricardo On Dec 1, 11:55 pm, brian [EMAIL PROTECTED] wrote: FWIW, same problem using $('form#myform').find('*').filter('input,select,textarea'); It seems that jQuery creates a new collection but iterates through for each selector in filter(), gathering matches from the source, rather than running through the source and comparing each element with each selector. Did that make sense? On Mon, Dec 1, 2008 at 5:15 PM, Hector Virgen [EMAIL PROTECTED] wrote: Is there a way to make $.fn.find() return the elements in the order they appear in the dom instead of grouped by selector? For example, let's say I have a form and I want to get the first form control, whether it's an input, select, or textarea. Here's some basic HTML: form id=#myform select// ... ///select input type=text / /form I thought I could do this, but it's returning the wrong element: var form_controls = $('form#myform').find('input, select, textarea'); console.log('first: ' + form_controls[0].tagName); // -- first: INPUT, should be SELECT Is there a way to get the desired effect with jQuery? Thanks! -Hector
[jQuery] Re: Ajax to return more values
What a waste of time and processing power Embrace JSON, it really does make life super easy And for whatever server side code you use, there are libraries out there to *automatically* convert your objects and results into perfectly valid JSON strings, there's no need to worry about messing up ( and { and the like. Whatever though, it's your time and effort... but you seriously are making things much harder on yourself than need be On Dec 2, 9:20 am, me-and-jQuery [EMAIL PROTECTED] wrote: That's a good point, but in my case I will stick with regex. Another idea is to use multiple top html elements (divs for example) and then query for values of div you want. On Dec 1, 6:11 pm, Andy Matthews [EMAIL PROTECTED] wrote: If you're using a 3rd party JSON library, then you'd just pass in whatever language construct you've got and let the library encode for you. andy -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of me-and-jQuery Sent: Monday, December 01, 2008 11:04 AM To: jQuery (English) Subject: [jQuery] Ajax to return more values Ho-ho-ho. I wonder what is the best practice if I want to get 2 or three values back to function with ajax. The last value would be lots of html code and first two kind of state values (number or short string). I don't like jSON a lot, since you need to return one-line response and you must be careful with a shape ( and }). Second option is having a regex to fetch first two values and all remaining is a third value. And what do you think is the best solution here? Happy December, me-and-jQuery
[jQuery] [tooltip]
Version 1.3, this tooltip plugin: http://docs.jquery.com/Plugins/Tooltip How can I determine with Firebug whether an element HAS gotten bound to the .toolip() successfully? I have a checkbox INPUT element that simply won't display the tooltip, although it's working perfectly for several A elements. It's not limited to only being used with anchors, is it?
[jQuery] Re: jQuery plug-in to preload javascript?
If all these scripts are on every single page, you should look into combining them all into a single file as well, this way there's only 1 HTTP request instead of 12. Do this first, then compress with JSMin or YUI compressor to reduce file size. On Dec 1, 6:22 pm, Mark Livingstone [EMAIL PROTECTED] wrote: Hi. There are numerous plug-ins to preload images, but is there a way to preload javascript? My application uses around 12 plug-ins and they take about 20 seconds or so to load before the page shows... so, is there a way I can display a loading message while I somehow preload the scripts? Thanks,
[jQuery] Re: Josh Nathanson's magnify not showing stage in IE7
Hey Josh, thanks for helping me out. Your plugin has helped me quite a bit already. It may be JS conflict, it may be CSS (but I think I ruled out z- index)... I sent the link to your gmail address. Thanks! On Dec 1, 5:44 pm, Josh Nathanson [EMAIL PROTECTED] wrote: Andrew -- I just checked the demo page on IE7 and it seems to work fine. Can you post your code or a test page somewhere I can look at? -- Josh (plugin author) -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Andrew Sent: Monday, December 01, 2008 3:02 PM To: jQuery (English) Subject: [jQuery] Josh Nathanson's magnify not showing stage in IE7 I am almost certain that I previously had it working in IE7, which leads me to think it's some new JS that is conflicting but I can't figure it out. Where can I start to look for IE7 conflicts?
[jQuery] $.ajax async: false bug?
Hi, colleagues I would appreciate your opinion/advice on the following I'm trying to save extra run to the back end by overwriting JS url variable with AJAX function and activate download from the visitor's browser as described by code below. Unfortunately what happens is extra run to the back end happens in any case in spite of the fact that AJAX runs successfully. Do you think it's related to the bug ignoring async: false, definition or it's mistake I've made and missed to catch? Thank you in advance HTML code = a href=/download.php?what=PDF_A onclick=javascript:download ('PDF_A')Download/a JS code === function download ( what ) { var url = download.php; $.ajax({ type: GET, url: download.php?ajax=true, data: what= + what async: false, dataType: script }); // if AJAX got the download URL, actual download starts, otherwise do that on the back end: location.href = url; } Back end (download.php) code === $myPDF = array(); $myPDF[PDF_A] = PDF_A.pdf; $url = http://mysite.com/; . $myPDF[PDF_A]; ... if ( $_GET[ajax] === true ) { // overwrite JS url variable print('url = '.$url.';'); } else { header(Location: . $url ); header(Connection: close); }
[jQuery] Re: how could I select the applet node in jquery
If there is only one applet tag in your page you can use $(applet). if there are few applet tags in the page you can define a class to this specific applet and call it like that: $(.myApplet). On 2 דצמבר, 10:47, Gill Bates [EMAIL PROTECTED] wrote: currently I have a applet node with random names and ids everytime in my velocity page. I wonder if we have some selectors to select this element
[jQuery] Having trouble with autocomplete - stupid newbie
You guys, I'm having problems implementing the autocomplete plugin. My page that I'm working on: I'm trying to bind .result(function(event, data, formatted) { to my element that's firing the autocomplete and I can't even get it to pop an alert. This is from Jorn's site. I think I can figure out how to parse the XML if I can get it to fire a result. I'm lost. Can anyone help? I just need to get that result binding to fire. Here's the code and page I'm working on. https://www.uakron.edu/ace/jquery-autocomplete/demo/index1.html
[jQuery] list.scrollTop is not a function when ever i using jquery auto complete
Hi, friends I am new to jquery, i am using jquery auto complete , it was working fine fing i got the below errror i.e list.scrollTop is not a function. what is the reason for this error , if any one know please send mail Thanks and Regards swamy
[jQuery] Error in jQuery documentation?
Hello, I think i've found an error in the jQuery documentation, or i am misunderstanding something. This page: http://docs.jquery.com/CSS/offset ... states that offset() gives you 'the current offset of the first matched element relative to the viewport.' My tests seem to show that it actually gives the offset relative to the document, NOT the viewport. If it were relative to the viewport, the number should change as I scroll the document around; it doesn't. It stays the same which suggests to me it's relative to the top-left of the document. May I change the documentation to reflect this? Best regards, Jeremy Morton (Jez)
[jQuery] autocomplete plugin - newbie question
You guys, I really dig working with jQuery, very powerful stuff. I've been trying to implement the autocomplete plugin but I don't know how to ask this question, or google what I need to know. We have 6000 staff (records) here on campus and we want to be able to search them by their first last name. I have to use an XML web service that's controlled by another group. Getting the output changed would be near impossible, so it's gotta come out this way. I curl that XML into a PHP. I pass that php a GET argument of name, in this instance casey and below is what it comes back with. Can this be done with XML like this using the autocomplete plugin searchResults status=OK totalEntries4/totalEntries entry employeeID=cmwise email[EMAIL PROTECTED]/email firstNameCasey/firstName fullNameCasey M Wise/fullName zip3501/zip department name=Application Systems Svs titleSr Web Developer/title /department buildingCOMP 115/building lastNameWise/lastName phone330/972-6523/phone displayNameMr Casey M Wise/displayName /entry entry employeeID=cem22 email[EMAIL PROTECTED]/email firstNameCasey/firstName fullNameCasey E Merriman/fullName zip3001/zip department name=Speech, Lang/Path Audiology titleGraduate Assistant/title /department building/building lastNameMerriman/lastName phone/phone displayName Casey E Merriman/displayName /entry entry employeeID=cfm2 email/email firstNameCasey/firstName fullNameCasey F Miller/fullName zip4731/zip department name=Human Resources titleEmployment Services Assistant/title /department buildingASB 135/building lastNameMiller/lastName phone330/972-5988/phone displayNameMs Casey F Miller/displayName /entry entry employeeID=cbakula email[EMAIL PROTECTED]/email firstNameCasey/firstName fullNameCasey J Bakula/fullName zip3904/zip department name=Electrical Computer Engr titleGraduate Assistant/title /department building/building lastNameBakula/lastName phone/phone displayNameCasey J Bakula/displayName /entry /searchResults
[jQuery] jQuery.Validate: validating input fields with [] [validate]
Hi, Does anyone know how you can validate forms that contain [] in their name? e.g. input type=text name=field[2] id=field2 class=box1 value= / I've tried all sorts with no luck! I also want to keep the validation code seperate, so with a $(document).ready Any help would be grand! Cheers Philsbury
[jQuery] Simple way to preload all images within a specific div?
Hi, I'm trying to do the following using jQuery: When a user clicks on a link in the menu of the page, a sippet of html code is loaded from an external html file (thus removing the navigation between several pages). This sippet contains a number of images (which will later become individual galleries using the SlideViewer plug-in, but that's not the problem). I've managed to make a function to load a specific div in this external html file, but I can't manage to preload the images they contain. See code below: $(document).ready(function() { // Function to preload images jQuery.preloadImages = function() { var a = (typeof arguments[0] == 'object')? arguments[0] : arguments; for(var i = a.length -1; i 0; i--) { jQuery(img).attr(src, a[i]); } } // Default content var currentSection = 'content.html #about'; var currentSlide = '#aboutSlide'; // Load selected content function loadContent() { $('#preloader').fadeIn(500, function() { $('#section').load(currentSection,'', function() { $.preloadImages(currentSlide, hidePreloader()); // Not working, just to show my intentions }); }); } // Hide preloader when content is ready and activate Slideviewer function hidePreloader() { $('#preloader').fadeOut(500, function() { showContent(); $(currentSlide).slideView(); }); } // Show content upon completion function showContent() { $('#section').fadeIn(500); } }); I've searched for jQuery preload scripts but nearly all of them handle single images with specific urls. I need a function that can handle all the images contained in a div (by refering to it's id, or similar). Thanks, -Staffan
[jQuery] Getting totals per row
I'm relatively a newbie to jQuery. I am trying to create a timesheet application. One of the things I am attempting to do is have the totals column for each task. I have the several textboxes laid out beside the text name (one textbox per day, so 7 textboxes for the individual days + 1 for the total column). The textboxes are named using the following convention: ta_[taskid]_[calendar date]. The totals row is named tatoal_[taskid]. So I have something like this: input type=text name=ta_1_20081117 value=0 id=ta_1_20081117 / input type=text name=ta_1_20081118 value=0 id=ta_1_20081118 / input type=text name=ta_1_20081119 value=0 id=ta_1_20081119 / input type=text name=ta_1_20081120 value=0 id=ta_1_20081120 / input type=text name=ta_1_20081121 value=0 id=ta_1_20081121 / input type=text name=ta_1_20081122 value=0 id=ta_1_20081122 / input type=text name=ta_1_20081123 value=0 id=ta_1_20081123 / input type=text name=tatotal_1 style=width:25px; value= id=tatotal_1 / Right now, I am able to dynamically set a function (updateTotals) to fire whenever one of the day textboxes are changed. The callback function looks like this: function updateTotal() { total = 0; $([EMAIL PROTECTED]'ta_ + 1 + ']).each(function(i,v){ if(!isNaN(parseInt(v.value))) { total += parseInt(v.value); }; }); $([EMAIL PROTECTED]'tatotal_ + 1 + ']).val(total); } The event is bound to the textboxes using the following code $(input[name^='ta_1']).change(updateTotal); I will have several rows of textboxes (e.g. ta_2, ta_3, ... ). Is there a way for me to pass a parameter to the updateTotal callback so have it do the totals for all of the tasks in the form? Any other more efficient algorithms with greatly be appreciated. Jett
[jQuery] An(other) IE issue...either case statement or select option manipulation issue or I don't know what..
Howdy, I searched the group for a few hours yesterday and didn't see anything that helped me. Maybe I overlooked it...anyway here's my issue: I have dropdowns of conference sessions which are ran twice each over the course of the conference. We don't want people signing up for the same session so I need to disable the option/session in other dropdowns. The below works in FF and Chrome but not IE. I've been able to disable an entire select in IE but not specific options. Other questions: is there a way to select an option by it's value? I don't know how so I added each option to a class of it's value. Also, is a case statement for each select tag the only way to do this or could I have one function that would cover all the selects? There are 18 sessions ran twice over 8 time periods/select dropdowns. Thanks! html head titleAjax with jQuery Example/title script type=text/JavaScript src=../jquery/jquery.js/script script $(document).ready(function(){ $(#session1).change(function (){ var selected = $(#session1 [EMAIL PROTECTED]).val(); /* ### I've also tried var selected = $ (#session1 option:selected).val();## */ switch(selected) { case '': $(#session2 option).removeAttr(disabled); break; case '2': $(#session2 option.2).attr(disabled, disabled), $(#session2 option. 11).removeAttr(disabled); break; case '11': $(#session2 option.11).attr(disabled, disabled), $(#session2 option. 2).removeAttr(disabled); break; } }); }); /script /head body div id=selectDIV select name=session1 id=session1class=titles option value=Select a Session/option option value=2 class=2Session 2/option option value=11 class=11Session 11/option option value=16 class=16Session 16/option /select br br select name=session2 id=session2class=titles option value=Select a Session/option option value=2 class=2Session 2/option option value=6 class=6Session 6/option option value=11 class=11Session 11/option /select /div /body /html
[jQuery] star rating 2.5 - select full stars only
Hi, i am using star ratin 2.5. Is there a way to restrict votes on full fill stars and use the split stars view only for displaying the results? Thanks
[jQuery] Jörn Zaefferer's documentation generator
Hello, I can't seem to get this to work: http://jquery.bassistance.de/docTool/docTool.html Not even with the Test with Example code. I click Generate, and nothing happens. I tried it online, and I tried the downloadable version. Help? Or is there another one to use? I really really really really want to turn my inline documentation into browsable HTML, and jsdoc just doesn't do it. Thanks! James Pittman
[jQuery] Re: list.scrollTop is not a function when ever i using jquery auto complete
I've had that error before, but it was an old version of the file what version are you using? i've been running 1.0.2 and have no more issues like that On Dec 2, 10:42 am, SWAMY [EMAIL PROTECTED] wrote: Hi, friends I am new to jquery, i am using jquery auto complete , it was working fine fing i got the below errror i.e list.scrollTop is not a function. what is the reason for this error , if any one know please send mail Thanks and Regards swamy
[jQuery] Re: Image rollover using jQuery
Thank you. This is exactly what I want! On Dec 1, 12:46 pm, howa [EMAIL PROTECTED] wrote: http://code.google.com/p/jquery-swapimage/ Ray
[jQuery] Re: jQuery plug-in to preload javascript?
One way to reduce loading time is to use $.getScript to only load a plug-in when you're actually using it. If you keep you're scripts on the head you won't be able to display any loading status, cause the document body isn't there yet. - ricardo On Dec 1, 10:22 pm, Mark Livingstone [EMAIL PROTECTED] wrote: Hi. There are numerous plug-ins to preload images, but is there a way to preload javascript? My application uses around 12 plug-ins and they take about 20 seconds or so to load before the page shows... so, is there a way I can display a loading message while I somehow preload the scripts? Thanks,
[jQuery] Re: jQuery.Validate: validating input fields with [] [validate]
I think you're looking for this: http://docs.jquery.com/Plugins/Validation/Reference#Fields_with_complex_names_.28brackets.2C_dots.29 Jörn On Tue, Dec 2, 2008 at 2:26 PM, Philsbury [EMAIL PROTECTED] wrote: Hi, Does anyone know how you can validate forms that contain [] in their name? e.g. input type=text name=field[2] id=field2 class=box1 value= / I've tried all sorts with no luck! I also want to keep the validation code seperate, so with a $(document).ready Any help would be grand! Cheers Philsbury
[jQuery] Re: [tooltip]
The tooltip should work with all elements that trigger a mouseover event and have a title. Though there are known problems with selects, so problems with checkboxes are not unlikely, too. You could try to add a label to the checkbox and put the title on the label. Link it via the for-attribute and it could be good enough. Jörn On Tue, Dec 2, 2008 at 5:38 PM, donb [EMAIL PROTECTED] wrote: Version 1.3, this tooltip plugin: http://docs.jquery.com/Plugins/Tooltip How can I determine with Firebug whether an element HAS gotten bound to the .toolip() successfully? I have a checkbox INPUT element that simply won't display the tooltip, although it's working perfectly for several A elements. It's not limited to only being used with anchors, is it?
[jQuery] Re: Can find() return elements in DOM order?
Unfortunately webkit doesn't support neither .sourceIndex nor .compareDocumentPosition. Here's another take, this should work in all browsers: $.fn.inOrder = function(sel){ return this.filter(function(){ return $(this).is(sel); }); } $('body *').inOrder('div,span,p') First you need to select all elements inside your desired context (could be $('*', 'body') ), then use the plugin to filter the relevant elements. Nowadays every browser guarantees the elements in DOM order if you're catching all of them, despite this not being in the standard. If only filter() would not reorder elements (I think it calls find() again when you pass a simple selector to it) that would be much easier. Interesting to know that the pseudo-selector keeps the elements in order, maybe it's running a filter just like this one (don't have time to look at the source). cheers, - ricardo On Dec 2, 2:29 pm, Hector Virgen [EMAIL PROTECTED] wrote: Thanks for the plugin, Ricardo. It works great in FF3 and IE7, but it doesn't work in Chrome. For my current needs, using the selector :input provides the form input controls in the dom order. var first_form_control = $('form#myform').find(':input').eq(0); Thanks for the help and suggestions. :) -Hector On Mon, Dec 1, 2008 at 7:13 PM, brian [EMAIL PROTECTED] wrote: looks good! $('#myform').find('input,select,textarea').sort(); On Mon, Dec 1, 2008 at 9:09 PM, ricardobeat [EMAIL PROTECTED] wrote: Here's a kind of 'DOM order sort plugin' I just made adapting code from the 'getElementsByTagNames' function by Peter-Paul Koch (http:// www.quirksmode.org/dom/getElementsByTagNames.html). I haven't tested it anywhere besides FF3. Just use it as: $('div,span').sort() (function($){ $.fn.sort = function(){ var arr = $.makeArray(this), firstNode = this[0]; if (firstNode.sourceIndex) { arr.sort(function (a,b) { return a.sourceIndex - b.sourceIndex; }); } else if (firstNode.compareDocumentPosition) { arr.sort(function (a,b) { return 3 - (a.compareDocumentPosition(b) 6); }); }; return $(arr); }; })(jQuery); I'd appreciate some feedback if this works :] - ricardo On Dec 1, 11:55 pm, brian [EMAIL PROTECTED] wrote: FWIW, same problem using $('form#myform').find('*').filter('input,select,textarea'); It seems that jQuery creates a new collection but iterates through for each selector in filter(), gathering matches from the source, rather than running through the source and comparing each element with each selector. Did that make sense? On Mon, Dec 1, 2008 at 5:15 PM, Hector Virgen [EMAIL PROTECTED] wrote: Is there a way to make $.fn.find() return the elements in the order they appear in the dom instead of grouped by selector? For example, let's say I have a form and I want to get the first form control, whether it's an input, select, or textarea. Here's some basic HTML: form id=#myform select// ... ///select input type=text / /form I thought I could do this, but it's returning the wrong element: var form_controls = $('form#myform').find('input, select, textarea'); console.log('first: ' + form_controls[0].tagName); // -- first: INPUT, should be SELECT Is there a way to get the desired effect with jQuery? Thanks! -Hector
[jQuery] Re: autocomplete plugin - newbie question
There isn't a XML example, but it should be possible to adapt this json example: http://dev.jquery.com/view/trunk/plugins/autocomplete/demo/json.html Basically replace the dataType and change the parsing code. You can still use jQuery to convert the xml response to JavaScript objects. See for example http://www.xml.com/pub/a/2007/10/10/jquery-and-xml.html Jörn On Tue, Dec 2, 2008 at 3:47 PM, Casey Wise [EMAIL PROTECTED] wrote: You guys, I really dig working with jQuery, very powerful stuff. I've been trying to implement the autocomplete plugin but I don't know how to ask this question, or google what I need to know. We have 6000 staff (records) here on campus and we want to be able to search them by their first last name. I have to use an XML web service that's controlled by another group. Getting the output changed would be near impossible, so it's gotta come out this way. I curl that XML into a PHP. I pass that php a GET argument of name, in this instance casey and below is what it comes back with. Can this be done with XML like this using the autocomplete plugin searchResults status=OK totalEntries4/totalEntries entry employeeID=cmwise email[EMAIL PROTECTED]/email firstNameCasey/firstName fullNameCasey M Wise/fullName zip3501/zip department name=Application Systems Svs titleSr Web Developer/title /department buildingCOMP 115/building lastNameWise/lastName phone330/972-6523/phone displayNameMr Casey M Wise/displayName /entry entry employeeID=cem22 email[EMAIL PROTECTED]/email firstNameCasey/firstName fullNameCasey E Merriman/fullName zip3001/zip department name=Speech, Lang/Path Audiology titleGraduate Assistant/title /department building/building lastNameMerriman/lastName phone/phone displayName Casey E Merriman/displayName /entry entry employeeID=cfm2 email/email firstNameCasey/firstName fullNameCasey F Miller/fullName zip4731/zip department name=Human Resources titleEmployment Services Assistant/title /department buildingASB 135/building lastNameMiller/lastName phone330/972-5988/phone displayNameMs Casey F Miller/displayName /entry entry employeeID=cbakula email[EMAIL PROTECTED]/email firstNameCasey/firstName fullNameCasey J Bakula/fullName zip3904/zip department name=Electrical Computer Engr titleGraduate Assistant/title /department building/building lastNameBakula/lastName phone/phone displayNameCasey J Bakula/displayName /entry /searchResults
[jQuery] Re: [tooltip] Image preview choppy when switching from right to left side of mouse pointer?
You example code didn't quite make it through. Could you provide a testpage? Maybe via jsbin.com Jörn On Tue, Dec 2, 2008 at 6:50 PM, deronsizemore [EMAIL PROTECTED] wrote: I'm not sure if I did it right or not, but I added the width too this line: return $( ).attr(src, this.src); Still not change after adding the width in. I think it's related to how big the image actually is for whatever reason. The other images don't do it, just the ones next to the right margin, but when I made the width smaller than 440 in the line above, it's fine, but only when it's a larger image is it choppy when you move your mouse around. Jörn Zaefferer-2 wrote: You could set a fixed with for the tooltip. That should improve the positioning. Jörn On Tue, Dec 2, 2008 at 3:08 PM, deronsizemore [EMAIL PROTECTED] wrote: I've implemented http://bassistance.de/jquery-plugins/jquery-plugin-tooltip/ plugin at this test page: http://www.randomjabber.com/test/logogala/gallery_tooltip.html. I think I've implemented it correctly, but I'm not completely sure of that? It seems to work like it should when you hover over the left two images in the left two columns. But, when you hover over the images in the right column and the image preview pops up to the left of the mouse pointer instead of to the right (since the margin of the browser window is there) the tracking seems to be a little choppy when you move your mouse around. Is this something I'm doing wrong? Is there something I can add to fix this or is it just the nature of the plugin? Thanks, Deron -- View this message in context: http://www.nabble.com/-tooltip--Image-preview-choppy-when-switching-from-right-to-left-side-of-mouse-pointer--tp20792886s27240p20792886.html Sent from the jQuery General Discussion mailing list archive at Nabble.com. -- View this message in context: http://www.nabble.com/-tooltip--Image-preview-choppy-when-switching-from-right-to-left-side-of-mouse-pointer--tp20792886s27240p20797403.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: Selecting only partial text from div
Have a look at this plugin: http://plugins.learningjquery.com/expander/ I'm sure you could adjust that to get something like what you want. On Mon, Dec 1, 2008 at 9:55 PM, [EMAIL PROTECTED] [EMAIL PROTECTED]wrote: I've a div which has lot of contents inside it... I need to display only text of length less than 100letters..anything more should be displayed only when I point to the word after it For example: divThis is the 100th word this is/div Here when I move my mouse from 'T' in This to 'h' in 100th I need to display This is the 100th and when I move my cursor to 'w' in word - I need to get word this is I heard about using mouse position to get this but I don't know how. Komin
[jQuery] Re: JavaScript multithreading issues, race conditions, critical sections
I've never worked on a really complex project using JS, but I'll contribute with my amateur views anyway: All JS engines are single-threaded, one less thing to worry about :] The exception is of course, AJAX calls which are asynchronous, they are technically not executing at the same time, but you can have the callbacks fire one instantly after the other. jQuery's logic for events and DOM manipulation already protects you a bit from doing something stupid. The most likely situation to happen is one where callbacks are executed multiple times and manipulate the DOM overriding each other's changes. But that wouldn't crash the browser or anything, and it can be prevented just by using well structured code, not allowing two handlers to manipulate the same section of the page, or making sure that subsequent Ajax calls whose functions overlap can cancel each other. I'm not an expert, but the main 4 reasons for a webapp to crash on js are: 1. memory leaks 2. humongous DOM manipulation (likely would timeout) 3. too many event handlers 4. stupid things like infinite loops or a synchronous http request - ricardo On Dec 2, 12:42 am, László Monda [EMAIL PROTECTED] wrote: Hi List, My question is not specific to jQuery and I don't wanna be offtopic, but I post there because I think there are the brightest minds of the planet regarding JavaScript development. We're building a web2.0 application and there are some singleton objects and various AJAX event handlers that manipulate them. I'm worried that race conditions can occur which have a potential to kill the client side. http://www.developer.com/lang/jscript/article.php/3592016- This is the most relevant article that I could find about avoiding race conditions in JavaScript, but I'm not really confident about its content and there's very little information accessible on multithreaded issues regarding JavaScript. So basically I'd like to get some clarifications on whether JavaScript is multithreaded and if so, how one can build rock solid code that don't mess up the client side. Thanks in advance, Laci http://monda.hu
[jQuery] Re: [tooltip] Image preview choppy when switching from right to left side of mouse pointer?
I'm not sure if I did it right or not, but I added the width too this line: return $( ).attr(src, this.src); Still not change after adding the width in. I think it's related to how big the image actually is for whatever reason. The other images don't do it, just the ones next to the right margin, but when I made the width smaller than 440 in the line above, it's fine, but only when it's a larger image is it choppy when you move your mouse around. Jörn Zaefferer-2 wrote: You could set a fixed with for the tooltip. That should improve the positioning. Jörn On Tue, Dec 2, 2008 at 3:08 PM, deronsizemore [EMAIL PROTECTED] wrote: I've implemented http://bassistance.de/jquery-plugins/jquery-plugin-tooltip/ plugin at this test page: http://www.randomjabber.com/test/logogala/gallery_tooltip.html. I think I've implemented it correctly, but I'm not completely sure of that? It seems to work like it should when you hover over the left two images in the left two columns. But, when you hover over the images in the right column and the image preview pops up to the left of the mouse pointer instead of to the right (since the margin of the browser window is there) the tracking seems to be a little choppy when you move your mouse around. Is this something I'm doing wrong? Is there something I can add to fix this or is it just the nature of the plugin? Thanks, Deron -- View this message in context: http://www.nabble.com/-tooltip--Image-preview-choppy-when-switching-from-right-to-left-side-of-mouse-pointer--tp20792886s27240p20792886.html Sent from the jQuery General Discussion mailing list archive at Nabble.com. -- View this message in context: http://www.nabble.com/-tooltip--Image-preview-choppy-when-switching-from-right-to-left-side-of-mouse-pointer--tp20792886s27240p20797403.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: Selecting only partial text from div
How are you going to move your mouse over 'w in word' if it's not being displayed yet? O.o On Dec 2, 12:55 am, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I've a div which has lot of contents inside it... I need to display only text of length less than 100letters..anything more should be displayed only when I point to the word after it For example: divThis is the 100th word this is/div Here when I move my mouse from 'T' in This to 'h' in 100th I need to display This is the 100th and when I move my cursor to 'w' in word - I need to get word this is I heard about using mouse position to get this but I don't know how. Komin
[jQuery] Re: with out ready event
Yes you can, but you need to wait for the DOM to be ready to manipulate any elements, so what you can do is a bit limited. You can also, for example, put your scripts at the bottom of the body or after the elements you're manipulating, then you don't need to use ready() or onload. But it's not very clean. - ricardo On Dec 2, 4:38 am, Sensible [EMAIL PROTECTED] wrote: Hi, Can we write any code out of $(document).ready(); Thanks Waiting 4 reply.
[jQuery] Re: with out ready event
I usually create my functions/classes outside of $(document).ready(), and then call them from within $(document).ready(). -Hector On Tue, Dec 2, 2008 at 10:02 AM, ricardobeat [EMAIL PROTECTED] wrote: Yes you can, but you need to wait for the DOM to be ready to manipulate any elements, so what you can do is a bit limited. You can also, for example, put your scripts at the bottom of the body or after the elements you're manipulating, then you don't need to use ready() or onload. But it's not very clean. - ricardo On Dec 2, 4:38 am, Sensible [EMAIL PROTECTED] wrote: Hi, Can we write any code out of $(document).ready(); Thanks Waiting 4 reply.
[jQuery] Re: [tooltip] Image preview choppy when switching from right to left side of mouse pointer?
Sorry about that. Here's the test page that I'm continuing to work on: http://www.randomjabber.com/test/logogala/gallery_tooltip.html You can see the updated code by viewing the head via the source. Thanks, Jörn Zaefferer-2 wrote: You example code didn't quite make it through. Could you provide a testpage? Maybe via jsbin.com Jörn On Tue, Dec 2, 2008 at 6:50 PM, deronsizemore [EMAIL PROTECTED] wrote: I'm not sure if I did it right or not, but I added the width too this line: return $( ).attr(src, this.src); Still not change after adding the width in. I think it's related to how big the image actually is for whatever reason. The other images don't do it, just the ones next to the right margin, but when I made the width smaller than 440 in the line above, it's fine, but only when it's a larger image is it choppy when you move your mouse around. Jörn Zaefferer-2 wrote: You could set a fixed with for the tooltip. That should improve the positioning. Jörn On Tue, Dec 2, 2008 at 3:08 PM, deronsizemore [EMAIL PROTECTED] wrote: I've implemented http://bassistance.de/jquery-plugins/jquery-plugin-tooltip/ plugin at this test page: http://www.randomjabber.com/test/logogala/gallery_tooltip.html. I think I've implemented it correctly, but I'm not completely sure of that? It seems to work like it should when you hover over the left two images in the left two columns. But, when you hover over the images in the right column and the image preview pops up to the left of the mouse pointer instead of to the right (since the margin of the browser window is there) the tracking seems to be a little choppy when you move your mouse around. Is this something I'm doing wrong? Is there something I can add to fix this or is it just the nature of the plugin? Thanks, Deron -- View this message in context: http://www.nabble.com/-tooltip--Image-preview-choppy-when-switching-from-right-to-left-side-of-mouse-pointer--tp20792886s27240p20792886.html Sent from the jQuery General Discussion mailing list archive at Nabble.com. -- View this message in context: http://www.nabble.com/-tooltip--Image-preview-choppy-when-switching-from-right-to-left-side-of-mouse-pointer--tp20792886s27240p20797403.html Sent from the jQuery General Discussion mailing list archive at Nabble.com. -- View this message in context: http://www.nabble.com/-tooltip--Image-preview-choppy-when-switching-from-right-to-left-side-of-mouse-pointer--tp20792886s27240p20797861.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: Getting totals per row
Give all of your day inputs the same class (say, DayInput). Do the same for the total divs (eg, TotalDiv). Then wrap each group of DayInputs, together with their corresponding TotalDiv in a div or tbody (you can have several of those in a table). Now, assign a handler to each $('.DayInput') which will locate and update the correct TotalInput based on its parent div or tbody. Something like: $(this).parent('tbody').children('.TotalInput') On Tue, Dec 2, 2008 at 7:23 AM, Jett [EMAIL PROTECTED] wrote: I'm relatively a newbie to jQuery. I am trying to create a timesheet application. One of the things I am attempting to do is have the totals column for each task. I have the several textboxes laid out beside the text name (one textbox per day, so 7 textboxes for the individual days + 1 for the total column). The textboxes are named using the following convention: ta_[taskid]_[calendar date]. The totals row is named tatoal_[taskid]. So I have something like this: input type=text name=ta_1_20081117 value=0 id=ta_1_20081117 / input type=text name=ta_1_20081118 value=0 id=ta_1_20081118 / input type=text name=ta_1_20081119 value=0 id=ta_1_20081119 / input type=text name=ta_1_20081120 value=0 id=ta_1_20081120 / input type=text name=ta_1_20081121 value=0 id=ta_1_20081121 / input type=text name=ta_1_20081122 value=0 id=ta_1_20081122 / input type=text name=ta_1_20081123 value=0 id=ta_1_20081123 / input type=text name=tatotal_1 style=width:25px; value= id=tatotal_1 / Right now, I am able to dynamically set a function (updateTotals) to fire whenever one of the day textboxes are changed. The callback function looks like this: function updateTotal() { total = 0; $([EMAIL PROTECTED]'ta_ + 1 + ']).each(function(i,v){ if(!isNaN(parseInt(v.value))) { total += parseInt(v.value); }; }); $([EMAIL PROTECTED]'tatotal_ + 1 + ']).val(total); } The event is bound to the textboxes using the following code $(input[name^='ta_1']).change(updateTotal); I will have several rows of textboxes (e.g. ta_2, ta_3, ... ). Is there a way for me to pass a parameter to the updateTotal callback so have it do the totals for all of the tasks in the form? Any other more efficient algorithms with greatly be appreciated. Jett
[jQuery] Re: how to avoid overhead
You're right to question the requirement to add that many divs. But assuming it's necessary, that code is not the fastest way to do it. This would be faster, especially in IE: var n = 1600; var html = new Array( n + 2 ); html[0] = 'div'; for( var i = 1; i = n; ++i ) html[i] = 'div/div'; html[i] = '/div'; $( html.join('') ).appendTo('#parentDiv'); There are several reasons this is faster: 1) It stores the HTML text in an array, then joins the array when it's completed. This is much faster than string concatenation in IE. Also: 1a) It preallocates the array at its final length. 1b) It stores the values directly in the array elements instead of using array.push(). 2) It wraps all of the divs in one container div, i.e. the resulting HTML (with whitespace added for clarity) is: div div/div ... div/div /div Actually I'm not sure if #2 makes a difference in this case - I'd have to test it. But #1 can make a big difference. -Mike From: [EMAIL PROTECTED] I would start by evaluating the requirement for adding 1599 divs. The way you have written it is probably the most efficent cross browser way of appending that much content but it will still crawl. On Dec 2, 10:53 am, Dirceu Barquette [EMAIL PROTECTED] wrote: Hi! The code: for (i = 0; i 1600 ;i ++) { htm += 'div/div';} $(htm).appendTo('#parentDiv'); How can avoid overhead? thanks, Dirceu Barquette
[jQuery] Re: listnav plugin mod
Hi, Have you made any progress on this? If not, I might be able to look into it some time tonight. Offhand, if you just want a 0-9 and not a nav item for each number, I think the code will need to be modified so that the search that adds the single letter classes to each LI will add another unique class name for items with text that start with 0-9 (like 'num' or something), and some other adjustments might need to be made to use that class. - Jack idgcorp wrote: I would like to add numerical functionality to this plugin, but have been unsuccessful in getting it to work. In additition to the A, B, C...Z I would like to add an 0-9 category for names that start with a number. the way the plugin is written to auto create class names from the letters is straightforward but for the numbers I would need to show all items that start with 0-9 under the '0' class. I know what I need to do but havent been able to get it to work.
[jQuery] Re: listnav plugin
Alexsandro, can you give me a few examples, so I can be sure I understand what you're looking for? Thanks, Jack Alexsandro_xpt wrote: Hello all, I would like to add somes methods like refresh/add/remove item from list too. Thz. On 1 dez, 05:04, idgcorp [EMAIL PROTECTED] wrote: Hi Jack, thanks for the reply, yes Im just adding/removing via jq Ive created a workaround that solves this one for me. Also I just posted another question, I would love to get this new one solved its driving me nuts!http://groups.google.com/group/jquery-en/browse_thread/thread/d10260b... On Nov 26, 7:58pm, Jack Killpatrick [EMAIL PROTECTED] wrote: Glad you like the plugin. Can you give me a little more about your use case so I'm sure I know what you're asking for? IE, are you just adding/removing LI's? - Jack idgcorp wrote: I have implemented this awesome plugin with great success and would like to know if its possible to refresh the plugin after appending/ removing data from the list. Can I break the connection and then rebind the data?
[jQuery] Re: listnav plugin
What's the workaround you came up with? It might give me some ideas on how best to approach baking something into the plugin. Thanks, Jack idgcorp wrote: Hi Jack, thanks for the reply, yes Im just adding/removing via jq Ive created a workaround that solves this one for me. Also I just posted another question, I would love to get this new one solved its driving me nuts! http://groups.google.com/group/jquery-en/browse_thread/thread/d10260b0ed3fa4ff/6b8b83bb5d21348a#6b8b83bb5d21348a On Nov 26, 7:58pm, Jack Killpatrick [EMAIL PROTECTED] wrote: Glad you like the plugin. Can you give me a little more about your use case so I'm sure I know what you're asking for? IE, are you just adding/removing LI's? - Jack idgcorp wrote: I have implemented this awesome plugin with great success and would like to know if its possible to refresh the plugin after appending/ removing data from the list. Can I break the connection and then rebind the data?
[jQuery] Re: how to avoid overhead
You're not going to get good enough performance from handling thousands of elements. I tried that myself last year: http://ff6600.org/desenhador/ff66.htm It used to run ok in FF2, but somethign in FF3 makes it really slow. If you draw with the middle-mouse button performance is better (I didn't cancel the context menu), guess it's still selecting stuff when you use left click. A better approach is using the canvas element, or maybe SVG/VML. A lot has been done in this area: http://canvaspaint.org/ http://raphaeljs.com/ 'Raphael and Isabela' sounds like a nice couple :D - ricardo On Dec 2, 11:02 am, Dirceu Barquette [EMAIL PROTECTED] wrote: Thank you!! please! see the example at isabeladraw.sourceforge.net. I've been forced build blocks against the entire board. But I'm thinking create child-by-child onmouseover position. sorry my english... Dirceu Barquette 2008/12/2 [EMAIL PROTECTED] [EMAIL PROTECTED] I would start by evaluating the requirement for adding 1599 divs. The way you have written it is probably the most efficent cross browser way of appending that much content but it will still crawl. On Dec 2, 10:53 am, Dirceu Barquette [EMAIL PROTECTED] wrote: Hi! The code: for (i = 0; i 1600 ;i ++) { htm += 'div/div';} $(htm).appendTo('#parentDiv'); How can avoid overhead? thanks, Dirceu Barquette
[jQuery] using depends method with Validate() plugin
Hi, I am using the Validate() plugin for various forms and I run into this issue with the depends method on various places. So far I found only two references to dealing with depends: http://docs.jquery.com/Plugins/Validation/validate $(.selector).validate({ rules: { contact: { required: true, email: { depends: function(element) { return $(#contactform_email:checked) } } } } }) http://dev.jquery.com/ticket/2456 billingAddress: { required:true, minlength:5 equalTo: { param: #shippingaddress, depends: #compare:checked } } first of all non of these work for me so there must be something going on with them. but my real problem is that I want validation depending on fields other then checkboxes. 1. I only want to require zip code if the selected country from a drop down list is USA. something like this: zip: { required: { depends: #countrycode:1 } }, where countrycode represents the country selector and 1 is the value for USA 2. in a from for password change I only want to require current password if new password is entered. something like this: current_password: { minlength: 6, required: { depends: #new_password } }, with this one I'd assume that if new_password is not empty then set the rule. I also found this page: http://dev.distilldesign.com/log/2008/mar/16/extending-jquery-form- validation-plugin/ http://lab.distilldesign.com/jquery-form-validation/extending/ this one works, though he uses checkboxes as well. here he basically extends the validate() plugin: $.validator.addMethod('dependsOn', function (value, el, params) { return !$(params.el).is(params.being) || $(el).is(':filled'); }, 'This field is required.'); then he uses the new method in the rule: emailDependent: { dependsOn: { el: '#emailMethod', being: ':checked' }, email: true }, I am not a javascript wizard so this method writing is getting my head dizzy. Can anyone tell me if there is a simple way of using depends in rules for validate() plugin? Thanks, Luke
[jQuery] Re: First steps in jQuery: trying to figure the syntax to mix standard Javascript with jQuery
Actually the [0] doesn't convert anything, and it doesn't remove or replace any methods. You could think of it that way, but here's a more accurate way to look at it: The jQuery object is an array of DOM elements. (It's not an actual Array object, but it is an array-like object with [0], [1], etc. and .length properties.) When you use [0], you are simply getting a reference to the first DOM element in this array, without affecting the jQuery object itself. Consider this code: var $div = $('div.selectable'); var div0 = $div[0]; Now $div is the jQuery object with all of its usual methods, and div0 is the first DOM element in the jQuery object's array of elements. Doing the $div[0] didn't have any effect on $div - it still has all of the normal jQuery methods. It's very much like this code: var array = [ 'a', 'b', 'c' ]; var first = array[0]; alert( array.length ); // 3 alert( first.length ); // 1 In this case it's more obvious that doing the array[0] doesn't have any effect on the original array. It's merely fetching a reference to the first array element, which happens to be a string. I hope this doesn't seem too nitpicky! :-) Just trying to help illustrate how it actually works. -Mike From: Ryura The glue code is converting your jQuery object. var text = $('div.selectable')[0].getSelection(); alert(text); [0] takes the first element you selected and removes the jQuery methods, replacing them with the usual DOM methods.
[jQuery] Can't retrieve title attr from area; no problem with other attrs
Using: $(area).tooltip({ delay: 0, fade: 250, bodyHandler: function() { var content = $(this).attr(title); console.log(content); return $(p).html(content); } }); console logs empty returns and the tooltip is empty. Note that this is an issue with the attr method, not tooltip. If I set content equal to attr(shape) or attr(name), name attribute supplied, the method works fine. Why would the title attribute return nothing on an element that returns all other attributes normally? Here's an example area that returns all non-title attributes: area title=AL shape=poly coords=omitted for brevity name=Alabama/area Ideas? Why would only title fail to return?
[jQuery] Re: finding script tags in remote HTML
geek Before I answer, I've gotta ask (I've been wondering for MONTHS), have you read the Starrigger series? /geek Now that that's out of the way, I can think of a couple of approaches. #1. Parse the links with regex $.get(link,{},function(html){ var r_links = /a\b[^]*?href\s*=\s*[']([^']+)[^]*/gi; var m; while (m=r_links.exec(html)) { makeRequest(m[1]); } }); #2. Remove the script tags and inline events with regex, then grab the HTML. var makeRequest = function(link) { $.get(link, {}, function(html){ html = html.replace(/script\b[\s\S]*?\/script/gi,'').replace(/on\w+\s*=\s*([']) [^']+\1/gi,''); $(a, html).each(function(){ makeRequest($(this).attr(href)); }); }); } -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Jake McGraw Sent: Tuesday, December 02, 2008 7:09 AM To: jquery-en@googlegroups.com Subject: [jQuery] Re: finding script tags in remote HTML I'm using jQuery AJAX to recursively spider a website to build a sitemap.xml file. I'll acknowledge that this is an ass backwards method for building a sitemap, but let's put aside that issue. My issue is that I'd like to be able to parse anchors in each page, but not execute the JavaScript on the page. The pseudo code looks something like: var makeRequest = function(link) { $.get(link, {}, function(html){ $(a, html).each(function(){ makeRequest($(this).attr(href)); }); }); } $(a).each(function(){ makeRequest($(this).attr(href)); }); My problem is that when I do $(a, html), the html is executed (DOM?) and IE complains about JavaScript errors. My question is can I prevent the JS from being executed, external resources from being loaded (img, css) but still get the anchors for each page? - jake On Thu, Nov 6, 2008 at 1:01 PM, axemonkey [EMAIL PROTECTED] wrote: Hi all. I'm having an amazing amount of pain trying to parse and execute JS script blocks in remote HTML (in IE, typically). Here's the code in question: $.ajax({ type: POST, url:checkFilename, dataType: text, success:function(src){ var wtf = $(src).find(script).each(function(){ eval( $(this).text() ); }); } }); http://www.pastie.org/308878 checkFilename is just an HTML file, so src comes back with the entire source of that page. What I want to do then is use find() to get all inline script tags inside the body of the page, and use eval()* to run them. Elsewhere before this happens a large chunk of HTML from checkFilename is loaded and displayed, and now I need to run any inline JS that was in the page. The above function works perfectly in FF2 and FF3, but IE completely fails to find any instances of script tags in src. Any ideas? I can't extract the inline JS blocks in question, as they are dynamic and inserted by a CMS that I have no control over. Thanks in advance, --Clive. * I know it's evil, but I need it in this instance...
[jQuery] Re: Can't retrieve title attr from area; no problem with other attrs
I'm pretty sure the ToolTip plugin *removes* the title tag from the matched items try something like this to confirm area state=AL shape=poly coords=omitted for brevity name=Alabama/area $(area).tooltip({ delay: 0, fade: 250, bodyHandler: function() { var content = $(this).attr(state); console.log(content); return $(p).html(content); } }); On Dec 2, 2:21 pm, 703designs [EMAIL PROTECTED] wrote: Using: $(area).tooltip({ delay: 0, fade: 250, bodyHandler: function() { var content = $(this).attr(title); console.log(content); return $(p).html(content); } }); console logs empty returns and the tooltip is empty. Note that this is an issue with the attr method, not tooltip. If I set content equal to attr(shape) or attr(name), name attribute supplied, the method works fine. Why would the title attribute return nothing on an element that returns all other attributes normally? Here's an example area that returns all non-title attributes: area title=AL shape=poly coords=omitted for brevity name=Alabama/area Ideas? Why would only title fail to return?
[jQuery] Re: finding script tags in remote HTML
On Tue, Dec 2, 2008 at 2:23 PM, Jeffrey Kretz [EMAIL PROTECTED] wrote: geek Before I answer, I've gotta ask (I've been wondering for MONTHS), have you read the Starrigger series? /geek Previously, Googling jake mcgraw would bring up hits for the Starrigger series... as you can see: http://www.google.com/search?q=jake+mcgraw I've fixed that. I know about the series but have never read any of it. Now that that's out of the way, I can think of a couple of approaches. #1. Parse the links with regex $.get(link,{},function(html){ var r_links = /a\b[^]*?href\s*=\s*[']([^']+)[^]*/gi; var m; while (m=r_links.exec(html)) { makeRequest(m[1]); } }); #2. Remove the script tags and inline events with regex, then grab the HTML. var makeRequest = function(link) { $.get(link, {}, function(html){ html = html.replace(/script\b[\s\S]*?\/script/gi,'').replace(/on\w+\s*=\s*([']) [^']+\1/gi,''); $(a, html).each(function(){ makeRequest($(this).attr(href)); }); }); } I'll test what the performance is for eacvh of those methods, thanks for the advice. - jake -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Jake McGraw Sent: Tuesday, December 02, 2008 7:09 AM To: jquery-en@googlegroups.com Subject: [jQuery] Re: finding script tags in remote HTML I'm using jQuery AJAX to recursively spider a website to build a sitemap.xml file. I'll acknowledge that this is an ass backwards method for building a sitemap, but let's put aside that issue. My issue is that I'd like to be able to parse anchors in each page, but not execute the JavaScript on the page. The pseudo code looks something like: var makeRequest = function(link) { $.get(link, {}, function(html){ $(a, html).each(function(){ makeRequest($(this).attr(href)); }); }); } $(a).each(function(){ makeRequest($(this).attr(href)); }); My problem is that when I do $(a, html), the html is executed (DOM?) and IE complains about JavaScript errors. My question is can I prevent the JS from being executed, external resources from being loaded (img, css) but still get the anchors for each page? - jake On Thu, Nov 6, 2008 at 1:01 PM, axemonkey [EMAIL PROTECTED] wrote: Hi all. I'm having an amazing amount of pain trying to parse and execute JS script blocks in remote HTML (in IE, typically). Here's the code in question: $.ajax({ type: POST, url:checkFilename, dataType: text, success:function(src){ var wtf = $(src).find(script).each(function(){ eval( $(this).text() ); }); } }); http://www.pastie.org/308878 checkFilename is just an HTML file, so src comes back with the entire source of that page. What I want to do then is use find() to get all inline script tags inside the body of the page, and use eval()* to run them. Elsewhere before this happens a large chunk of HTML from checkFilename is loaded and displayed, and now I need to run any inline JS that was in the page. The above function works perfectly in FF2 and FF3, but IE completely fails to find any instances of script tags in src. Any ideas? I can't extract the inline JS blocks in question, as they are dynamic and inserted by a CMS that I have no control over. Thanks in advance, --Clive. * I know it's evil, but I need it in this instance...
[jQuery] Re: using depends method with Validate() plugin
OK this works: current_password: { minlength: 6, required: { depends: #new_password:filled } }, I still need to figure out how to get a value recognized: zip: { required: { depends: #countrycode:'1' } }, Luke On Dec 2, 2008, at 11:44 AM, luke adamis wrote: Hi, I am using the Validate() plugin for various forms and I run into this issue with the depends method on various places. So far I found only two references to dealing with depends: http://docs.jquery.com/Plugins/Validation/validate $(.selector).validate({ rules: { contact: { required: true, email: { depends: function(element) { return $(#contactform_email:checked) } } } } }) http://dev.jquery.com/ticket/2456 billingAddress: { required:true, minlength:5 equalTo: { param: #shippingaddress, depends: #compare:checked } } first of all non of these work for me so there must be something going on with them. but my real problem is that I want validation depending on fields other then checkboxes. 1. I only want to require zip code if the selected country from a drop down list is USA. something like this: zip: { required: { depends: #countrycode:1 } }, where countrycode represents the country selector and 1 is the value for USA 2. in a from for password change I only want to require current password if new password is entered. something like this: current_password: { minlength: 6, required: { depends: #new_password } }, with this one I'd assume that if new_password is not empty then set the rule. I also found this page: http://dev.distilldesign.com/log/2008/mar/16/extending-jquery-form- validation-plugin/ http://lab.distilldesign.com/jquery-form-validation/extending/ this one works, though he uses checkboxes as well. here he basically extends the validate() plugin: $.validator.addMethod('dependsOn', function (value, el, params) { return !$(params.el).is(params.being) || $(el).is(':filled'); }, 'This field is required.'); then he uses the new method in the rule: emailDependent: { dependsOn: { el: '#emailMethod', being: ':checked' }, email: true }, I am not a javascript wizard so this method writing is getting my head dizzy. Can anyone tell me if there is a simple way of using depends in rules for validate() plugin? Thanks, Luke
[jQuery] Re: using depends method with Validate() plugin
Either depends: #countrycode[value=1] or depends: function() { return $(#countrycode).val() == '1'; } Jörn On Tue, Dec 2, 2008 at 8:42 PM, luke adamis [EMAIL PROTECTED] wrote: OK this works: current_password: { minlength: 6, required: { depends: #new_password:filled } }, I still need to figure out how to get a value recognized: zip: { required: { depends: #countrycode:'1' } }, Luke On Dec 2, 2008, at 11:44 AM, luke adamis wrote: Hi, I am using the Validate() plugin for various forms and I run into this issue with the depends method on various places. So far I found only two references to dealing with depends: http://docs.jquery.com/Plugins/Validation/validate $(.selector).validate({ rules: { contact: { required: true, email: { depends: function(element) { return $(#contactform_email:checked) } } } } }) http://dev.jquery.com/ticket/2456 billingAddress: { required:true, minlength:5 equalTo: { param: #shippingaddress, depends: #compare:checked } } first of all non of these work for me so there must be something going on with them. but my real problem is that I want validation depending on fields other then checkboxes. 1. I only want to require zip code if the selected country from a drop down list is USA. something like this: zip: { required: { depends: #countrycode:1 } }, where countrycode represents the country selector and 1 is the value for USA 2. in a from for password change I only want to require current password if new password is entered. something like this: current_password: { minlength: 6, required: { depends: #new_password } }, with this one I'd assume that if new_password is not empty then set the rule. I also found this page: http://dev.distilldesign.com/log/2008/mar/16/extending-jquery-form- validation-plugin/ http://lab.distilldesign.com/jquery-form-validation/extending/ this one works, though he uses checkboxes as well. here he basically extends the validate() plugin: $.validator.addMethod('dependsOn', function (value, el, params) { return !$(params.el).is(params.being) || $(el).is(':filled'); }, 'This field is required.'); then he uses the new method in the rule: emailDependent: { dependsOn: { el: '#emailMethod', being: ':checked' }, email: true }, I am not a javascript wizard so this method writing is getting my head dizzy. Can anyone tell me if there is a simple way of using depends in rules for validate() plugin? Thanks, Luke
[jQuery] jQuery-specific selected (highlighted) text?
Hello, I'm still a beginner with jQuery (and not really fluent in JavaScript), but I begin to understand how it works. I am trying to move the following code to jQuery: var text = window.getSelection(); alert(text); It shows me the currently highlighted part of an xhtml page. Now I want to use jQuery because it allows me to filter the text according to the class it is part of, by doing something in the style of: $('td.selectable').each(function() { var text = this.innerHTML; alert(text); }) My problem is that I cannot find an equivalent to window.getSelection() in jQuery, nor use getSelection() with the jQuery objects (once again, beginner alert, maybe I'm missing something obvious here). So, what would you do in order to restrict the returned text to the part of the DOM that is currently selected (highlighted)? Thanks. -- View this message in context: http://www.nabble.com/jQuery-specific-selected-%28highlighted%29-text--tp20800335s27240p20800335.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: using depends method with Validate() plugin
Thanks! I found the page as well: http://docs.jquery.com/Plugins/Validation/Methods/required#dependency- expression I wonder how I could miss this page. Luke On Dec 2, 2008, at 2:05 PM, Jörn Zaefferer wrote: Either depends: #countrycode[value=1] or depends: function() { return $(#countrycode).val() == '1'; } Jörn On Tue, Dec 2, 2008 at 8:42 PM, luke adamis [EMAIL PROTECTED] wrote: OK this works: current_password: { minlength: 6, required: { depends: #new_password:filled } }, I still need to figure out how to get a value recognized: zip: { required: { depends: #countrycode:'1' } }, Luke On Dec 2, 2008, at 11:44 AM, luke adamis wrote: Hi, I am using the Validate() plugin for various forms and I run into this issue with the depends method on various places. So far I found only two references to dealing with depends: http://docs.jquery.com/Plugins/Validation/validate $(.selector).validate({ rules: { contact: { required: true, email: { depends: function(element) { return $(#contactform_email:checked) } } } } }) http://dev.jquery.com/ticket/2456 billingAddress: { required:true, minlength:5 equalTo: { param: #shippingaddress, depends: #compare:checked } } first of all non of these work for me so there must be something going on with them. but my real problem is that I want validation depending on fields other then checkboxes. 1. I only want to require zip code if the selected country from a drop down list is USA. something like this: zip: { required: { depends: #countrycode:1 } }, where countrycode represents the country selector and 1 is the value for USA 2. in a from for password change I only want to require current password if new password is entered. something like this: current_password: { minlength: 6, required: { depends: #new_password } }, with this one I'd assume that if new_password is not empty then set the rule. I also found this page: http://dev.distilldesign.com/log/2008/mar/16/extending-jquery-form- validation-plugin/ http://lab.distilldesign.com/jquery-form-validation/extending/ this one works, though he uses checkboxes as well. here he basically extends the validate() plugin: $.validator.addMethod('dependsOn', function (value, el, params) { return !$(params.el).is (params.being) || $(el).is(':filled'); }, 'This field is required.'); then he uses the new method in the rule: emailDependent: { dependsOn: { el: '#emailMethod', being: ':checked' }, email: true }, I am not a javascript wizard so this method writing is getting my head dizzy. Can anyone tell me if there is a simple way of using depends in rules for validate() plugin? Thanks, Luke
[jQuery] [autocomplete] and asp.net / dotnetnuke
I want to have autocomplete work with DotNetNuke(asp.net). Did anybody did this already and if so how? The solution I am investigating now ( 2 December 2008) involves using page methods as described on http://encosia.com/2008/06/05/3-mistakes-to-avoid-when-using-jquery-with-aspnet-ajax/ with standard autocomplete functionality. Is this the right way to do it or are there other ways?
[jQuery] Change number of images shown
This seems like a simple thing to do put I cannot figure out how to do it. I'm implementing the jcarousel scripts but cannot figure out how to chnage the number of display pictures. Any ideas? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups jQuery (English) group. To post to this group, send email to jquery-en@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/jquery-en?hl=en -~--~~~~--~~--~--~---
[jQuery] Re: clearcase error when trying to add jquery-1.2.6.min.js to source control
Hi ksun, I seem to recall reading somewhere that you need to set the file type for jquery as compressed in clearcase (this gets around the long line issue). Hope that helps... Mark On Dec 2, 6:45 am, ksun [EMAIL PROTECTED] wrote: Today I tried adding jquery-1.2.6.min.js to source control (Rational ClrearCase). below is the error I got. I didn't get the error when I tried jquery-1.2.6.js. Anyone know why the minified version gives the error. I would like to use the minified version for the obvious reasons. I found some topics when googling this error about using binary type for the file. My understanding is that the minified file is a text file, I don't have any problem opening in DreamWeaver (it is definitely text) , Is clearcase thinking it is not a text file? Error Message : Type manager text_file_delta failed create_version operation. PS: I would rather not use Clearcase, but I am stuck with it at my current workplace. Thanks ksun
[jQuery] Fixed div, content scrolls under it
I'm looking at the possibility of having navigation at the top of the page, pinned to the top. I'd like for the content to scroll UNDER the container. I've seen it before, but forgot to bookmark it to see how it was done. Does anyone have a plugin for this, or know how it's accomplished and can point me to an example? andy
[jQuery] Re: Has jQuery development halted?
Hi Ariel, On Dec 1, 2:39 pm, Ariel Flesler [EMAIL PROTECTED] wrote: I'd simply check the trac to see if developmenthalted, instead of asking it publicly in such a challenging way. It might be obvious to you to 'simply check the trac', but i'm sure a lot of people have never been there. At the same time on the official jquery blog the latest post about Jquery UI is from september, and it says This is also the final version before the real deal, which can be expected to follow in the next days. It's two and a half months later, so you can't really blame me for asking about it, right? Anyhow, my apologies if I offended you, although I really don't understand _why_ you're offended.. If anything, my post was just about me being curious when we'll see a next release. And, if I didn't care about jQuery, I wouldn't be worried about it. Finally, if you're really into improving jQuery, this is how: http://dev.jquery.com/newticket I'd just add some more invalid tickets for you to close, so I won't do that. ;-) Like others have said: Thanks for your efforts, and I'm glad to see you take this so seriously. I'm looking forward to any and all new releases! Best, Bob.
[jQuery] Re: Fixed div, content scrolls under it
do you mean something other than: div id='nav'.../div div id='content' style='overflow-y:scroll'.../div Sounds like a CSS question, not a jQuery one... stephen On Tue, Dec 2, 2008 at 14:38, Andy Matthews [EMAIL PROTECTED]wrote: I'm looking at the possibility of having navigation at the top of the page, pinned to the top. I'd like for the content to scroll UNDER the container. I've seen it before, but forgot to bookmark it to see how it was done. Does anyone have a plugin for this, or know how it's accomplished and can point me to an example? andy
[jQuery] Re: Can't retrieve title attr from area; no problem with other attrs
That seems to be the case. Must be so that there are no duplicate tooltips. Thanks, Thomas On Dec 2, 2:27 pm, MorningZ [EMAIL PROTECTED] wrote: I'm pretty sure the ToolTip plugin *removes* the title tag from the matched items try something like this to confirm area state=AL shape=poly coords=omitted for brevity name=Alabama/area $(area).tooltip({ delay: 0, fade: 250, bodyHandler: function() { var content = $(this).attr(state); console.log(content); return $(p).html(content); } }); On Dec 2, 2:21 pm, 703designs [EMAIL PROTECTED] wrote: Using: $(area).tooltip({ delay: 0, fade: 250, bodyHandler: function() { var content = $(this).attr(title); console.log(content); return $(p).html(content); } }); console logs empty returns and the tooltip is empty. Note that this is an issue with the attr method, not tooltip. If I set content equal to attr(shape) or attr(name), name attribute supplied, the method works fine. Why would the title attribute return nothing on an element that returns all other attributes normally? Here's an example area that returns all non-title attributes: area title=AL shape=poly coords=omitted for brevity name=Alabama/area Ideas? Why would only title fail to return?