[jQuery] Re: $().someFunction(); -- The First Pair of Parentheses?
$ == jQuery to make jQuery work when other js frameworks are also in use you can make jQuery() work too - avoiding conflicts the first set of parenthis are for passing params to the jquery object AFAIK When setting defaults for jquery plugins the parenthis are not required. I don't know if they are optional here or not - plugin defaults are variables used by plugins, which extend the jquery object (props methods) - S 2009/5/3 kiusau kiu...@mac.com .getBrowserInformation
[jQuery] Re: $().someFunction(); -- The First Pair of Parentheses?
$() === $(document) --Klaus On 3 Mai, 07:39, kiusau kiu...@mac.com wrote: QUESTION: What does the first pair of parentheses indicate in the following statement: $().getBrowserInformation(); BACKGROUND: I have noticed that their presence or absence can make or break JavaScript's acknowledgement of a method's existence on the one hand, but seem entirely unnecessary under other circumstances. Roddy
[jQuery] Re: Is any one else experiencing serious slowdowns on their site due to 'waiting for jqueryui.com' ?
yeah scripts do run better they can b access more locally. just like images. they load longer if you loading them from another URL best to have the scripts on your FTP. On Sun, May 3, 2009 at 4:21 AM, Richard D. Worth rdwo...@gmail.com wrote: Thanks for the note. It's back up. - Richard On Sat, May 2, 2009 at 3:52 PM, hro hrayr.artun...@gmail.com wrote: Same problem here. jqueryui.com is down. On May 2, 11:18 am, stasch stash...@gmail.com wrote: I was surprised to today to discover that my site was running much slower than usual (3 to 4 times slower!). Most of the delay was spent with the message 'waiting for jqueryui.com'. This really freaked me out. First of all what gives the jquery folks the right to ping their site from their code? Second of all, if they're going to do that they'd better make sure that the site they are pinging is super fast. Can anybody enlighten me as to what is going on here? Better yet, how can I remove that code from my jquery library? I can't afford to have this kind of performance hit due to uncontrollable 'features' like this in my code. And if I'm legally bound to keep that code in the library please advise me so that I can go back to Prototype. Totally unacceptable!
[jQuery] Re: Minimum amount of checkbox selected validation
lets start by giving your form an id. lets call it chekform form id=checkform ... !-- say we have our checkboxes in here along with our submit lets give all of our checkboxes a class called check -- /form THE JQUERY $(function() { var obj = $(#checkform); // create a reference to the object var checkboxes = $(input.check, obj); // a reference to each check box with the class check var value; // variable that's is going to count how many boxes are checked //click function checkboxes.click(function() { var current = index($(this)); //gets the eq of the element clicked // if checkbox is checked. uncheck. else check if(checkboxes.eq(current).atrrib(checked) == checked) { checkboxes.eq(current).atrrib(checked) == value--; //decrement value } else { checkboxes.eq(current).atrrib(checked) = checked; value++ //increment value } }); /* from here on you can say submit if value 7 */ }); On Sun, May 3, 2009 at 1:46 AM, ameri...@gmail.com ameri...@gmail.comwrote: Hello, Trying to use jquery to validate that a minimum of 7 check boxes are selected. the code is as follows: $(document).ready(function() { $(form).submit(function() { if (!isCheckedById(AreasOfInterest[])) { alert (Please select at least 7 items); return false; } else { return true; //submit the form } }); function isCheckedById(id) { var checked = $(inp...@id=+id+]:checked).length; if (checked 7) { return false; } else { return true; } } }); It works if i set the (checked == 0) and then at least 1 is selected... but when i run it as is... it won't submit even if more than 7 are selected... Is my code wrong?? is the variable checked not an integer?? help!!
[jQuery] Re: POST Redirection
As I said in my last post. I'm creating a firefox extension -- there is no form. There is only my menu entry and when I fire it, nothing happens in firebug. But my question is not what url I get. I want to know where I have to look for it, because the url will be different everytime... Hope you still can help me. On May 2, 6:30 pm, Danny Nolan danny_no...@yahoo.co.uk wrote: got it installed? Enable it, have it running while viewing the form. Now submit the form and firebug will capture the post URL, will popup inside the firebug window. --- On Sat, 5/2/09, Cryptonit dom.helfenst...@gmail.com wrote: From: Cryptonit dom.helfenst...@gmail.com Subject: [jQuery] Re: POST Redirection To: jQuery (English) jquery-en@googlegroups.com Date: Saturday, May 2, 2009, 9:20 AM Could you please be a little more precise? I've installed firebug, now what? Maybe I also have to be more specific: I don't create a web page, I'm creating a firefox extension. So I can't just debug everything I like... Could you please point me to the exact property I have to look for? On 2 Mai, 02:07, Danny Nolan danny_no...@yahoo.co.uk wrote: Firebug is your friend --- On Fri, 5/1/09, Cryptonit dom.helfenst...@gmail.com wrote: From: Cryptonit dom.helfenst...@gmail.com Subject: [jQuery] POST Redirection To: jQuery (English) jquery-en@googlegroups.com Date: Friday, May 1, 2009, 2:22 PM Hi Folks! Here's my problem: I want to make a post request to a web service site. This site is automaticly redirecting me to a file. Now I want to find out the location of this file. As far as I can see (please correct me if there are more) there are two possible solutions: 1. I somehow disable redirecting (on jQuery) and so I would have the link to the file in the answer of my call 2. Or I read the final location after the redirection But of course I don't know how to do this... So I really hope someone can help me! Greetz cryptonit
[jQuery] Re: Binding hrefs in table entries
lets assume your button are hyperlinks so the element for that is a $(a).click(function() { var id = this.attr(id); // variable id will contain the clicked elements ID so you can say something like id.addClass(clicked); alert(id+ was clicked); }); On Sun, May 3, 2009 at 4:17 AM, Ingo ingemar.strandb...@gmail.com wrote: Hi, I'm quite new to jQuery and have a question. I'm populating a table with rows where some of the columns include links and buttons. For some of these links and buttons I want to run some jQuery stuff before it's redirected (acually, I want to have the result loaded in a div via ajax). In the jQuery function I want to be able to extract the ID of the button or the href target that was clicked. Now, the problem I'm having is that each of the rows in the table will generate a different ID for the buttons (otherwise it's not possible to separate them, right). How will I know in the jQuery function which button was pressed? I would be VERY glad for any help I can get. Please inform me if my explaination of the problem is unclear. Thanks in advance! /Ingo
[jQuery] Re: thickbox like in front page of Jquery website
You could use this as a starting point and just modify it to your liking http://jqueryfordesigners.com/coda-popup-bubbles/ On May 2, 4:48 am, sebastienj ouu...@gmail.com wrote: nobody's know?
[jQuery] Re: state of the art for corner rounding?
As far as safari / chrome goes you can use webkit- similar to moz- The only real browser behind the times is IE. On May 2, 2:41 pm, kiusau kiu...@mac.com wrote: On May 2, 5:21 am, Richard D. Worth rdwo...@gmail.com wrote: One of the best ones I've seen lately is DD_roundies, by Drew Diller: http://www.dillerdesign.com/experiment/DD_roundies/ DD Roundies were designed for an IE environment. They do not work well in the Firefox, Opera, and Safari environments. This is the reason that SVG Roundies were developed. My webpage incorporates SVG Roundies into jQuery just fine. View the following webpage in Firefox, Safari, or Opera. http://homepage.mac.com/moogoonghwa/Imagine_Prototype/Content/ You may discover more about SVG Roundies at http://www.highscore.de/SVG_roundies/ Roddy
[jQuery] Re: Implementing Thickbox within ajax style Jquery-ui-tabs
Hi, You had to call tb_init('a.thickbox, area.thickbox, input.thickbox'); Maybe you had to rename the thickbox classname (in case you have other thickbox links in the static page, the recall of this function will double the thickbox call). Cheers POB On 24 avr, 00:08, ButtersRugby buttersru...@gmail.com wrote: Hey guys! I have some ajax tabs using the jquery-ui-tabs features. Within these tabs are tables with links. There are name links I am trying to load with an ajax style thickbox modal window. Then linked within tabs, the thickbox will not initialize. When a static page with no tabs, the same code fires off the thickbox perfectly fine. Any guidance here in solving the issue.
[jQuery] Why JQuery Autocomplete displays only one item?
Am using JQuery Autocomplete on my django templete, but as i get the results the Autocomplete only displays one item despite that the results that are fetched have more that one item. It only shows the first item on the list! Example: if i have a result list with ('python', 'pythonism', 'pythodus') and on the autocomplete i type 'pyt' it only displays 'python' on the drop down! My autocomplete code: $(document).ready(function(){ $(#tags1).autocomplete(/taglookup/, { width: 320 }); }) My Ajax Django view that get called: def tag_lookup(request): # Default return list results = [] if request.method == GET: if request.GET.has_key(u'q'): value = request.GET[u'q'] # Ignore queries shorter than length 3 if len(value) 2: TI = Tag.objects.filter(name__contains=value) print TI results = [ x.name for x in TI] results = 'one|two|three' return HttpResponse(results, mimetype='text/plain') for testing purposes am hard coding the results just to check the behavior, so whenever ill type anything on the autocomplete field am excepting it to display a drop down list of 'one, two, three' but it only displays 'one'. Any ideas? Gath
[jQuery] Re: Superfish on roids second top level row problem (z-index?)
fuck off On 4/21/09, Mark nijme...@gmail.com wrote: hello, I want to use this menu but i have so many main items that there are 2 rows. The first row is always on top. How can i get the second level menu to be on top of the fisrt item menu-item1 menu-item2 menu-item3 menu-item4 menu-item5 menu-item6 menu-item7 menu-item8 menu-item9
[jQuery] Re: Is any one else experiencing serious slowdowns on their site due to 'waiting for jqueryui.com' ?
Hah, you should not link directly to the libraries on jQuery.com or jQueryUI.com as it might also break your site in case they upgrade the code. and it adds another dependency to another server you are not in control of... So don't blame them, but just create a local copy on your server! Or do you think they have unlimited resources to host million of hits per day for free?
[jQuery] Why JQuery Autocomplete displays only one item?
Am using JQuery Autocomplete on my templete, but as i get the results the Autocomplete only displays one item despite that the results that are fetched have more that one item. It only shows the first item on the list! Example: if i have a result list with ('python', 'pythonism', 'pythodus') and on the autocomplete i type 'pyt' it only displays 'python' on the drop down! My autocomplete code: $(document).ready(function(){ $(#tags1).autocomplete(/taglookup/, { width: 320 }); }) My Ajax Django view that get called; def tag_lookup(request): # Default return list results = [] if request.method == GET: if request.GET.has_key(u'q'): value = request.GET[u'q'] # Ignore queries shorter than length 3 if len(value) 2: TI = Tag.objects.filter(name__contains=value) print TI results = [ x.name for x in TI] results = 'one|two|three' return HttpResponse(results, mimetype='text/plain') Please note i have hard coded the result for testing purposes! so anything i type on the autocomplete field, i expect it to display a drop down list with 'one, two, three' but its only displaying 'one' Any ideas? Gath
re[jQuery] moveAttr('href') on document load?
$(function() { $('#add a').removeAttr('href'); }); What's wrong with this code? I want to remove all href's from a tags onload of a document. Still a bit new to jQuery so sorry for this silly question! Just been trying to figure it out for ages. The links are in a div with id add. Thanks for all the help! Sam -- View this message in context: http://www.nabble.com/removeAttr%28%27href%27%29-on-document-load--tp23355653s27240p23355653.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] How to remove 'null' or replace it with for the returned data?
$.getJSON('/MailDatQueryJsonAction', {mailDatHeaderID:maildatheaderid},function(data){ $('#historyJobID').attr(value,data.historyJobID); } In jquery-1.2.1.js, when data.historyJobID is empty,it will return ,correct!! But in jquery-1.3.2.min.js, it returns null. Who can help me resolve this problem?
[jQuery] Re: Is any one else experiencing serious slowdowns on their site due to 'waiting for jqueryui.com' ?
Instead of writing a long winded statement that was, well, worthless how about you suggest they use Google Ajax API/Hosting? http://code.google.com/apis/ajaxlibs/documentation/index.html#jquery -Original Message- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of Mike Sent: Sunday, May 03, 2009 9:05 AM To: jQuery (English) Subject: [jQuery] Re: Is any one else experiencing serious slowdowns on their site due to 'waiting for jqueryui.com' ? Hah, you should not link directly to the libraries on jQuery.com or jQueryUI.com as it might also break your site in case they upgrade the code. and it adds another dependency to another server you are not in control of... So don't blame them, but just create a local copy on your server! Or do you think they have unlimited resources to host million of hits per day for free?
[jQuery] Re: $().someFunction(); -- The First Pair of Parentheses?
FYI, not anymore. $() === $([]) It now returns an empty jQuery collection -- Ariel Flesler On May 3, 5:22 am, Klaus Hartl klaus.ha...@googlemail.com wrote: $() === $(document) --Klaus On 3 Mai, 07:39, kiusau kiu...@mac.com wrote: QUESTION: What does the first pair of parentheses indicate in the following statement: $().getBrowserInformation(); BACKGROUND: I have noticed that their presence or absence can make or break JavaScript's acknowledgement of a method's existence on the one hand, but seem entirely unnecessary under other circumstances. Roddy
[jQuery] Re: $().someFunction(); -- The First Pair of Parentheses?
Correction: $() === $(document) $(null) === $([]) $() === $([]) This is wrongly documented and has orphaned code, will report. -- Ariel Flesler On May 3, 12:16 pm, Ariel Flesler afles...@gmail.com wrote: FYI, not anymore. $() === $([]) It now returns an empty jQuery collection -- Ariel Flesler On May 3, 5:22 am, Klaus Hartl klaus.ha...@googlemail.com wrote: $() === $(document) --Klaus On 3 Mai, 07:39, kiusau kiu...@mac.com wrote: QUESTION: What does the first pair of parentheses indicate in the following statement: $().getBrowserInformation(); BACKGROUND: I have noticed that their presence or absence can make or break JavaScript's acknowledgement of a method's existence on the one hand, but seem entirely unnecessary under other circumstances. Roddy
[jQuery] Re: Minimum amount of checkbox selected validation
You can't have more than one element with the same ID, and AreasOfInterest[] is not a valid ID. It looks like you were hoping that the [] notation would give you an array of elements that have the same ID. Use a common classname on your checkboxes instead, e.g. input type=checkbox class=need7 id=first / input type=checkbox class=need7 id=second / input type=checkbox class=need7 id=third / ...etc... Then you can use: $(function() { $('form').submit( function() { if( $('input.need7:checked').length 7 ) { alert( 'Please select at least 7 items' ); return false; }); }); -Mike -Original Message- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of ameri...@gmail.com Sent: Saturday, May 02, 2009 4:46 PM To: jQuery (English) Subject: [jQuery] Minimum amount of checkbox selected validation Hello, Trying to use jquery to validate that a minimum of 7 check boxes are selected. the code is as follows: $(document).ready(function() { $(form).submit(function() { if (!isCheckedById(AreasOfInterest[])) { alert (Please select at least 7 items); return false; } else { return true; //submit the form } }); function isCheckedById(id) { var checked = $(inp...@id=+id+]:checked).length; if (checked 7) { return false; } else { return true; } } }); It works if i set the (checked == 0) and then at least 1 is selected... but when i run it as is... it won't submit even if more than 7 are selected... Is my code wrong?? is the variable checked not an integer?? help!!
[jQuery] Re: $().someFunction(); -- The First Pair of Parentheses?
Fixed: http://dev.jquery.com/changeset/6334 $() === $(document) $(undefined) === $([]) $(null) === $([]) $() === $([]) -- Ariel Flesler On May 3, 12:28 pm, Ariel Flesler afles...@gmail.com wrote: Correction: $() === $(document) $(null) === $([]) $() === $([]) This is wrongly documented and has orphaned code, will report. -- Ariel Flesler On May 3, 12:16 pm, Ariel Flesler afles...@gmail.com wrote: FYI, not anymore. $() === $([]) It now returns an empty jQuery collection -- Ariel Flesler On May 3, 5:22 am, Klaus Hartl klaus.ha...@googlemail.com wrote: $() === $(document) --Klaus On 3 Mai, 07:39, kiusau kiu...@mac.com wrote: QUESTION: What does the first pair of parentheses indicate in the following statement: $().getBrowserInformation(); BACKGROUND: I have noticed that their presence or absence can make or break JavaScript's acknowledgement of a method's existence on the one hand, but seem entirely unnecessary under other circumstances. Roddy
[jQuery] Re: state of the art for corner rounding?
I have not tried DD Roundies yet - it's on my todo list. Hoever I am using a jquery plug-in called 'Cornerz' that is working very well for me. It uses Canvas/VML for corners, but does not require any additional plug-ins: http://labs.parkerfox.co.uk/cornerz/ This plug-in does *not* automatically pick-up -moz-border-radius settings from CSS, but I have written an intermediate function that does. This accomplishes exactly what you are asking - with the exception that you still need to add the cornerz class to the elements you want rounded in IE to avoid having to check the CSS of every element on the page! I submitted this function to the plug-in's forum... http://groups.google.com/group/cornerz/browse_thread/thread/2f0639e7c7fa349c?hl=en# I'd be interested to learn how whether DD Roundies is significantly better or not. /Kevin On May 2, 9:45 am, Jack Killpatrick j...@ihwy.com wrote: bump. Anyone eval'd the corner plugins recently enough to have an opinion? Thx. Jack Jack Killpatrick wrote: Hi All, I have a half dozen bookmarks for rounded corner plugins, but am wondering if there's a state of the art plugin kicking any booty on that these days? What I'd *really* like is to just be able to set -moz border radiuses in CSS and have a plugin magically use those to create rounded corners in IE and Safari (IE mainly... using excanvas or something with it is fine, too). Any advice? For the project I'm working on now I don't need to have lines at the border (ie: no border:1px solid black or anything). Thanks, Jack- Hide quoted text - - Show quoted text -
[jQuery] Re: Is any one else experiencing serious slowdowns on their site due to 'waiting for jqueryui.com' ?
Yes, I was loading the javascript files from their site. I never do that, but I did. My bad. Sorry for the rant, it was a really bad day. Thanks for all the excellent feedback. On May 3, 7:52 am, Jordon Bedwell jor...@envygeeks.com wrote: Instead of writing a long winded statement that was, well, worthless how about you suggest they use Google Ajax API/Hosting?http://code.google.com/apis/ajaxlibs/documentation/index.html#jquery -Original Message- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of Mike Sent: Sunday, May 03, 2009 9:05 AM To: jQuery (English) Subject: [jQuery] Re: Is any one else experiencing serious slowdowns on their site due to 'waiting for jqueryui.com' ? Hah, you should not link directly to the libraries on jQuery.com or jQueryUI.com as it might also break your site in case they upgrade the code. and it adds another dependency to another server you are not in control of... So don't blame them, but just create a local copy on your server! Or do you think they have unlimited resources to host million of hits per day for free?
[jQuery] Re: Is any one else experiencing serious slowdowns on their site due to 'waiting for jqueryui.com' ?
The truth of the matter is, Jquery uses MediaTemple, and their site is very optimised and if you are loading the compressed libraries, you aren't using very much of their 1TB+ bandwidth they get a month. But I stick to if you really want to off-load the scripts so they load faster since some hosting companies tend to lag on static distribution I would go with Google API which only goes down, well actually only once that I know of :P. -Original Message- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of stasch Sent: Sunday, May 03, 2009 11:42 AM To: jQuery (English) Subject: [jQuery] Re: Is any one else experiencing serious slowdowns on their site due to 'waiting for jqueryui.com' ? Yes, I was loading the javascript files from their site. I never do that, but I did. My bad. Sorry for the rant, it was a really bad day. Thanks for all the excellent feedback. On May 3, 7:52 am, Jordon Bedwell jor...@envygeeks.com wrote: Instead of writing a long winded statement that was, well, worthless how about you suggest they use Google Ajax API/Hosting?http://code.google.com/apis/ajaxlibs/documentation/index.html#jq uery -Original Message- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of Mike Sent: Sunday, May 03, 2009 9:05 AM To: jQuery (English) Subject: [jQuery] Re: Is any one else experiencing serious slowdowns on their site due to 'waiting for jqueryui.com' ? Hah, you should not link directly to the libraries on jQuery.com or jQueryUI.com as it might also break your site in case they upgrade the code. and it adds another dependency to another server you are not in control of... So don't blame them, but just create a local copy on your server! Or do you think they have unlimited resources to host million of hits per day for free?
[jQuery] Re: Is any one else experiencing serious slowdowns on their site due to 'waiting for jqueryui.com' ?
On May 3, 6:54 pm, Jordon Bedwell jor...@envygeeks.com wrote: ... and if you are loading the compressed libraries, you aren't using very much of their 1TB+ bandwidth they get a month. ... Ok, but what happens if 1000 sites include jQuery from their page? 10.000 sites? Millions?
[jQuery] Re: Flexbox json_encode ??
Hi Nishan, Using FireBug, can you copy the JSON output your receiving in both cases. Chances are high the syntax varies between the script and the text file. Also, in the php script I wonder if it is using a Content- type whereas the text file is not. I haven't pointed Flexbox at a static text file before, so I really can't say for sure if that is an issue or not. Spencer On Mar 16, 1:30 am, Nishan Karassik karas...@gmail.com wrote: I have a strange problem, I'm trying to useFlexbox. I can use the JSON array when I output the array to a file and call it from within the html, but when I try to go direct to the file it won't work. I'm guessing my problem is with the json_array. I run json_generator.php json.txt Flexbox: script type=text/javascript $(document).ready(function() { $('#fb').flexbox('json.txt') }); It works, but when I use: script type=text/javascript $(document).ready(function() { $('#fb').flexbox('json_generator.php') }); It doesn't work. I can't figure it out. Is there something I need to do in the json_generator.php to make it look like a text file output?
Re: re[jQuery] moveAttr('href') on document load?
removeAttr() will take the whole href property out of the tag a href="" Test/a will become a Test/a if you want to keep href property you could overwrite the href values $('#add a').attr('href','#'); produces a href="" Test/a Sam Granger wrote: $(function() { $('#add a').removeAttr('href'); }); What's wrong with this code? I want to remove all href's from a tags onload of a document. Still a bit new to jQuery so sorry for this silly question! Just been trying to figure it out for ages. The links are in a div with id add. Thanks for all the help! Sam
Re: re[jQuery] moveAttr('href') on document load?
Awesome, thanks! That works exactly how I want it!:) -- View this message in context: http://www.nabble.com/removeAttr%28%27href%27%29-on-document-load--tp23355653s27240p23358695.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
Re: re[jQuery] moveAttr('href') on document load?
Thanks Charlie! That did the trick :) Charlie Tomlinson wrote: removeAttr() will take the whole href property out of the tag lt;a href=something.phpgt; Testlt;/agt; will become lt;agt; Testlt;/agt; if you want to keep href property you could overwrite the href values $('#add a').attr('href','#'); produces lt;a href=#gt; Testlt;/agt; Sam Granger wrote: $(function() { $('#add a').removeAttr('href'); }); What's wrong with this code? I want to remove all href's from a tags onload of a document. Still a bit new to jQuery so sorry for this silly question! Just been trying to figure it out for ages. The links are in a div with id add. Thanks for all the help! Sam -- View this message in context: http://www.nabble.com/removeAttr%28%27href%27%29-on-document-load--tp23355653s27240p23358784.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: $().someFunction(); -- The First Pair of Parentheses?
On May 3, 1:22 am, Klaus Hartl klaus.ha...@googlemail.com wrote: $() === $(document) So, if I have understood properly. jQuery must always be told Where to go! when called in an HTML document, but knows automatically where to go when called inside another jQuery method in a JavaScript document. Is this correct? Roddy
[jQuery] Re: need some suggestion about adding active class for one page link
I'm also having this problem. I'm using localscroll on a one-page site and need to add an active state to the navigation items. the problem is, it doesn't seem to work with local anchors. Not sure if it matters, but I also have sticky header and footer. Here's some example code: HTML: div id=header ul id=nav li id=nav_logoa href=/h4logo/h4/a/li li id=nav_caplefta href=#/a/li li id=nav_homea href=#homehome/a/li li id=nav_abouta href=#aboutabout/a/li li id=nav_portfolioa href=#portfolioportfolio/a/li li id=nav_contacta href=#contactcontact/a/li li id=nav_caprighta id=icon-rss href=#h4rss/h4/ aemSubscribe to our RSS Feed/em/li li id=nav_search/li /ul !-- end #header --/div JSCRIPT: jQuery(function( $ ){ // Scroll the x axis $.localScroll.defaults.axis = 'x'; // Scroll if there's a hash (#something) in the url $.localScroll.hash({ target: '#content', // Could be a selector or a jQuery object too. queue:true, duration:1500 }); /** * NOTE: I use $.localScroll instead of $('#navigation').localScroll () so I * also affect the and links. I want every link in the page to scroll. */ $.localScroll({ target: '#content', // could be a selector or a jQuery obje8¶ct too. queue:true, duration:1000, hash:true, onBefore:function( e, anchor, $target ){ // The 'this' is the settings object, can be modified }, onAfter:function( anchor, settings ){ // The 'this' contains the scrolled element (#content) } }); $(function(){ var path = location.pathname.substring(1); if ( path ) $('ul#nav li a...@href$=' + path + ']').attr('class', 'active'); });
[jQuery] Re: $().someFunction(); -- The First Pair of Parentheses?
On May 3, 8:59 am, Ariel Flesler afles...@gmail.com wrote: Fixed:http://dev.jquery.com/changeset/6334 This link was very useful. It taught me that fn in the following construction means prototype. (function($) { $.fn.someFunctionName function( ) { This functions code block }; })(jQuery); So, when I create a jQuery method, I am actually adding a property to the jQuery object. Roddy
[jQuery] Re: limiting many form input fields with global limit
Hi, thanks for so many helping messages ;-) But seriously, is it to hard to code that no one posted a clue? Best Regards On May 2, 12:03 am, MarkZ aps...@gmail.com wrote: Hi Could Anyone help me with this? I have a form witch contains e.g.: X input fields like this: form input type=text name=info0 input type=text name=info1 input type=text name=info2 textarea name=info3 /form And I need limit the global number of characters that are written to this form. E.g.: The global is set to 100 chars, and if user inputs 10 characters to input[name=info0] then he/she can use only 90 characters to fill in rest of the inputs. Then if user inputs 30 characters into input[name=info1], the global is set to 60. And so on, until the global reaches 0, then any letter in any input above the global limit has to be cut out. Please help if You have any fine ideas. Best Regards
[jQuery] Calling jQuery Methods and Having Them Execute in a Pre-Designated Order
QUESTION: How does one control the order in which jQuery methods are called and executed when loading a page? BACKGROUND: This question has been simplified from my previous question on load order. As this appears to be a complex issue -- otherwise, it would probably have been readily addressed -- I could likely be satisfied by a link or two that points to a well-written document on this topic. PREVIOUS QUESTION: http://groups.google.com/group/jquery-en/browse_thread/thread/371f0bd498d4446f# Roddy
[jQuery] Re: How to select all text in a div except ul
On May 2, 2009, at 9:28 PM, mkmanning wrote: Don't use .text(), you'll get an array-like object of text nodes. Tiny clarification: you'll get a concatenated string of text nodes. --Karl Karl Swedberg www.englishrules.com www.learningjquery.com On May 2, 2009, at 9:28 PM, mkmanning wrote: Don't use .text(), you'll get an array-like object of text nodes. Try var text = $('div').contents().filter(function(){return this.nodeType==3;}); console.log(text) On May 2, 6:06 pm, nick nboutel...@gmail.com wrote: Thanks for the response. Are you sure thats correct though? alert($('div').contents().filter(function(){return this.nodeType==3;}).text()); returns empty.
[jQuery] Simple .post won't work
Hello. Jquery noob, but lovin it. Can't get a rudimentary post to work, but probably missing something very simple. Alerts are working, but div content is never updated. Following in file called select.php: -- !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN http:// www.w3.org/TR/html4/loose.dtd html head ?php if(isset($_POST['color'])) { $color = $_POST['color']; } else { $color = 'black'; } ? script src=http://code.jquery.com/jquery-latest.js;/script script $(document).ready(function(){ $(select).change(function () { var theValue = this.value; //alert(theValue); $.post(select.php, { color: theValue },function(){alert (theValue);}); }); }); /script style div { color:red; } /style /head body select name=select id=select option value=/option option value=redred/option option value=greengreen/option option value=blueblue/option /select brbr div ?php echo $color; ? /div /body /html -- Thanks for your time...
[jQuery] Modifying element on drop into sortable list
Hi everyone, I've got a Draggable list working in conjunction with a Sortable list. When I drag an item from the draggable to the sortable list I want to modify the contents of the list. The code I'm using right now is: $(#list li).draggable({ connectToSortable: #page ol, containment: window, helper: clone, revert: true, revertDuration: 0, appendTo: body }); $(#page ol).sortable({ handle: .drag_handle, receive: function(event, ui) { $(ui.item).css('background','red'); } }); Instead of modifying the dropped element it actually modifies the source element in the draggable list. I've tried using ui.helper instead of ui.item but this has no effect whatsoever. Can anyone suggest a different way of going about this? Thanks in advance! Sam
[jQuery] Re: CSS Style Property Assigned by Class
That's exactly what the problem was. I never even thought about that because the css class declared it shorthand. The border-top-width, etc. worked. Thanks for your help! On May 2, 6:35 am, Paul Mills paul.f.mi...@gmail.com wrote: Hi, I think it may be to do with 'border' being shorthand for all the individual border properties. If you code this $('#byClass').append($('#byClass').css('border-top-width')); then it shows the width as '1px'. hth Paul On May 1, 9:39 pm, Panman01 rpann...@gmail.com wrote: One thing to note, I've found that this only seems to work in Opera. On May 1, 1:56 pm, Panman01 rpann...@gmail.com wrote: I have not been able to figure this out. If I missed some kind of RTFM or something obvious please let me know. I can take it ;) Thanks On Apr 30, 10:22 pm, Panman01 rpann...@gmail.com wrote: I just want to note that Google Groups wrapped a couple lines of the code. The DOCTYPE and jquery script will need to be fixed if you copy the code to test it. On Apr 30, 10:17 pm, Panman rpann...@gmail.com wrote: For some reason I cannot get jQuery.css('name') to return a style property that was assigned by a class. However, it returns the property if it was assigned by style=. Has anyone else run into this issue? Bug? Here is my test code: !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01//EN http://www.w3.org/ TR/html4/strict.dtd htmlhead titleCSS Test/title style type=text/css .apply-border { border: 1px solid blue;} /style script src=http://ajax.googleapis.com/ajax/libs/jquery/1.3/ jquery.min.js type=text/javascript/script script type=text/javascript $(document).ready(function() { $('#byStyle').append($('#byStyle').css('border')); $('#byClass').append($('#byClass').css('border'));}); /script /headbody p id=byStyle style=border: 1px solid green;Border applied by style = /p p id=byClass class=apply-borderBorder applied by class = /p /body/html
[jQuery] Re: Simple .post won't work
$(select).change(function () { var theValue = this.value; //alert(theValue); $.post(select.php, { color: theValue },function(){alert (theValue);}); }); There isn't any code here to change the div The PHP block you have at the top suggests some confusion about how this should work. That block will only be processed by PHP the first time the page is loaded. The $.post method makes an asynchronous request to the server. As such, your page is not evaluated by PHP as in the 1st request. In fact, this should be a completely separate script. Take all the PHP code out of there and rename the page to index.html (it can be a PHP page but that's unimportant just now). Change this: div ?php echo $color; ? /div to this: div id=my_color_div black /div Create a PHP script named 'select.php': ?php if (isset($_POST['color'])) { echo $_POST['color']; } else { echo 'something went wrong'; } ? Now change your JS: $(document).ready(function() { $(select).change(function() { var theValue = this.val(); $.ajax({ type: 'POST', url: '/select.php', data: 'color=' + theValue success: function(ret) { $('#my_color_div').html(ret); } }); }); }); I prefer using the ajax() function myself. You should be able to figure out from that what the options are for. The important thing is the success handler. It takes a param which is the result returned from the server. The body of that function simply updates your div with that content. In practice, I imagine you'd probably want to do something like update the CSS by returning the hex code for a color, eg. '#99'. $('#my_color_div').css('background-color', ret); On Sun, May 3, 2009 at 7:34 PM, erikober upperho...@gmail.com wrote: Hello. Jquery noob, but lovin it. Can't get a rudimentary post to work, but probably missing something very simple. Alerts are working, but div content is never updated. Following in file called select.php: -- !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN http:// www.w3.org/TR/html4/loose.dtd html head ?php if(isset($_POST['color'])) { $color = $_POST['color']; } else { $color = 'black'; } ? script src=http://code.jquery.com/jquery-latest.js;/script script $(document).ready(function(){ $(select).change(function () { var theValue = this.value; //alert(theValue); $.post(select.php, { color: theValue },function(){alert (theValue);}); }); }); /script style div { color:red; } /style /head body select name=select id=select option value=/option option value=redred/option option value=greengreen/option option value=blueblue/option /select brbr div ?php echo $color; ? /div /body /html -- Thanks for your time...
[jQuery] Re: Call for contributors: A simple, fast and flexible grid/spreadsheet component.
I understand the view that Ajax / Lazy-Loading doesn't belong in the grid's code-base but I do think an example showing a basic form of this functionality would be a big help. I know I'd appreciate it.
[jQuery] cluetip plugin: how to implement a cluetip picture to a homepage logo?
Hi I try to implement a picture as a cluetip that should show up when the user touches the homepage logo. I tried different things but did not make it properly. the logo had an awful border in the colors of the links and in Firefox 3 the cluetip did not show. any solutions? txs in advance Markus
[jQuery] Using Tablesorter with ajax generated tables
I am a newbie. I am wondering if someone can explain how to configure the tablesorter plugin to work with a table generated with ajax. My usage is straightforward. 1. User makes form selections 2. hits submit 3. parameters passed to php file 4. table is generated from php/mysql 5. result is delivered to a div it works well. The problem is that I don;t know how to apply tablesorter to it (I need pagination and sorting). I tried the default set-up as explained in the doc, but nothing happens. Something needs to be done differently to support ajax tables, but I don't know what it is. Any help would be appreciated. Thanks. (It doesn't have to be tablesorter if there is a better way.)
[jQuery] Superfish Vertical Menu - Can I change it to display submenus on left?
Love this menu. This menu will be appearing in module on right hand side of page. So I need the submenu to display on left, not right. So how to make this a right to left menu? I've played around a bit and have had no luck yet. I've used the navbar on another site and I'd really like to use this vertical menu too. Please help!
[jQuery] [validate] plugin does not validate form at all...
Hi All, I am trying to use the validate plugin to validate a form but it does not work..Could you please let me know what i am doing wrong? The page starts with a simple drop down asking for the user to choose a category. Once the category is chosen, a div block becomes visibile. WHen the user clicks submits the form, I would like to validate the form only for the visible elements. Since I was trying to figure out how to use the validate plugin i was just calling the plain .validate() call without any rules.. even that does not work.. I also tried removing the category selection and kept all the form elements visible.. even then I was able to get it to work... I am attaching the HTML code with the jquery validate call.. could you please let me know what i should do to make this work? Thanks! code !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http:// www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd html xmlns=http://www.w3.org/1999/xhtml; head title Validate /title meta http-equiv=Content-type content=text/html;charset=UTF-8 / script type=text/javascript src=include/jquery-1.3.2.min.js/ script script type=text/javascript src=include/ jquery.validate.pack.js/script script type=text/javascript !-- $(document).ready(function() { $(#uploadform).validate(); $('#id1').hide(); $('#id2').hide(); if ($('#category').val() == 'v1') $('#id1').show(); else if ($('#category').val() == 'v2') $('#id2').show(); $('#category').change(function() { if ($(this).val() == 'none') { $('#id1').hide(); $('#id2').hide(); } else if ($(this).val() == 'v1') { $('#id1').show(); $('#id2').hide(); } else if ($(this).val() == 'v2') { $('#id1').hide(); $('#id2').show(); } }); }); // -- /script /head body div id=categ-container div id=categ-content div pSelect your category to get started. /p label Category /label select id=category option value=none /option option value=v1 V1 /option option value=v2 V2 /option /select p/pp/p /div form id=uploadform method=post action=# div id=id1 table border=0 trtdlabel Location /label /td tdinput type=file name=file1//td/tr trtdlabel Cat1 /label /td td select id=id11 name=cat1 option value=v1 Value1 /option option value=v2 Value2 /option /select /td/tr trtdlabel Cat2 /label /td td select id=id12 name=cat2 option value=v3 Value3 /option option value=v4 Value4 /option /select /td/tr trtd labelText:/label/td tdinput type=text name=text1 id=text1 / /td /tr /table /div div id=id2 table border=0 trtdlabel Location /label /td tdinput type=file name=file2//td/tr trtdlabel Cat3 /label /td td select id=id21 name=cat3 option value=v5 Value5 /option option value=v6 Value6 /option /select /td/tr trtd labelText:/label/td tdinput type=text name=text2 id=text2 //td/tr /table /div pinput type=submit value=submit //p /form /div /div /body /html /code
[jQuery] Re: Using Tablesorter with ajax generated tables
Showing some snip of code would go a long way for others to help you pretty much keep in mind that you can't wire up the .tablesorter() call until the table exists on the DOM On May 3, 3:51 pm, msher...@gmail.com msher...@gmail.com wrote: I am a newbie. I am wondering if someone can explain how to configure the tablesorter plugin to work with a table generated with ajax. My usage is straightforward. 1. User makes form selections 2. hits submit 3. parameters passed to php file 4. table is generated from php/mysql 5. result is delivered to a div it works well. The problem is that I don;t know how to apply tablesorter to it (I need pagination and sorting). I tried the default set-up as explained in the doc, but nothing happens. Something needs to be done differently to support ajax tables, but I don't know what it is. Any help would be appreciated. Thanks. (It doesn't have to be tablesorter if there is a better way.)
[jQuery] help with an IE bug: marginTop
jquery1.3.2, 1.3.1, 1.2.6 IE 6, 7, 8 I have some code for a nested select list that opens child list when an anchor is clicked on, then retrieves some content through an ajax call. In between that, I'm displaying my loading image, which is done using a showIndicator() function. That, in turn, makes use of Alexandre Magno's jquery.center plugin.[1] IE is choking on it, though. The error is Invalid argument and points to line 1061. That bit of code is right at the end of attr: if ( set ) elem[ name ] = value; return elem[ name ]; Line 1061 is the 2nd line there. I added an alert(name) just above the if() and saw: position position height top marginTop I changed the code to: if ( set name != 'marginTop') elem[name] = value; return elem[ name ]; And it worked like a charm in all 3 versions. This is what led me to understand it was the center plugin causing the problem. Part of that code includes: var cssProp = { position: 'absolute' }; if(op.vertical) { cssProp.height = height; cssProp.top = '50%'; cssProp.marginTop = halfHeight; } if(op.horizontal) { cssProp.width = width; cssProp.left = '50%'; cssProp.marginLeft = halfWidth; } //check the current position if(positionType == 'static') { $self.parent().css(position,relative); } //aplying the css $self.css(cssProp); If I comment out the marginTop line (and remove my change to jquery itself) everything works. I'm assuming the marginLeft line would have the same effect. The really weird thing is that I've used this plugin before without any problems like this. I haven't gone back to dig up those apps yet; I thought I'd throw this out here to see if anyone had some idea for a workaround. [1] http://www.alexandremagno.net/jquery/plugins/center/
[jQuery] Re: jcarousel and text below image
Hi, Any more help on this please. Had no response since for weeks. I would realy apreciate the help. I looked up a lot of tutorials and stuff, and does not matter what I try, I do not manage to get it to work. Thanks. Hugo On Apr 18, 11:47 am, globalpropertyonline@gmail.com globalpropertyonline@gmail.com wrote: Hi Jay, Thanks for the help before but could you please be so kind to see me latest post below to brian and see what I have done so far and tell me where I am going wrong as I am still stuck with the text. I will realy apreciate it. Thanks Hugo On Apr 11, 12:49 am, jay jay.ab...@gmail.com wrote: You can put it at the very bottom and wrap it with script tags, or you could put it in the head in script tags like this: head script $(function(){ ..onload code goes here..}); /script /head Also $(document.body).appendChild(div); can go after the div is declared instead. I would suggest you perhaps read some books/ tutorials on javascript and/or jquery to learn more. It is very different from ASP since ASP is server-side code and javascript is client-side. On Apr 10, 4:01 pm, globalpropertyonline@gmail.com globalpropertyonline@gmail.com wrote: Me again I tried your code here like this. but it does not seem to work. Any pointers ??? script type=text/javascript function mycarousel_itemLoadCallback(carousel, state) { for (var i = carousel.first; i = carousel.last; i++) { if (carousel.has(i)) { continue; } if (i mycarousel_itemList.length) { break; } // Create an object from HTML var item = jQuery(mycarousel_getItemHTML(mycarousel_itemList [i-1])).get(0); // Apply thickbox tb_init(item); carousel.add(i, item); } }; /** * Item html creation helper. */ function mycarousel_getItemHTML(item) { var url_m = item.url.replace(/_s.jpg/g, '_m.jpg'); return 'a href=' + url_m + ' title=' + item.title + ' myrefval=' + item.myref + ' mydescval=' + item.mydesc + ' myCountryURLval=' + item.myCountryURL + ' myCountryval=' + item.myCountry + ' myRegionval=' + item.myRegion + ' myTownval=' + item.myTown + ' myTermval=' + item.myTerm + ' myAreaval=' + item.myArea + ' myagentcodeval=' + item.myagentcode + 'img src=' + item.url + ' width=175 height=125 border=0 alt=' + item.title + ' //a'; div = $(div style='display:none'blah/div) }; jQuery(document).ready(function() { jQuery('#mycarousel').jcarousel({ size: mycarousel_itemList.length, itemLoadCallback: {onBeforeAnimation: mycarousel_itemLoadCallback} }); }); jcarousel.find(img) .hover( function(){ div.css({display:'block',position:'absolute',left:$(this).offset ().left, top:$(this).offset().top+$(this).height()}); $(document.body).appendChild(div); }, function(){ div.css({display:'none'}); }); /script On Apr 10, 8:50 pm, globalpropertyonline@gmail.com globalpropertyonline@gmail.com wrote: Thank you for taking the time to respond to my question I am not vary good at Javascript and I am learning as I am going along. I do most of my stuff with ASP. Could you be so kind to tell me where I would place this code in the code that I supplied ? I managed to get this working by changing things and refresh. Takes me a long time, but I learn If you could tell me where to PLACE THIS CODE AND SEE IT IN ACTION, i CAN THEN TRY TO SEE WHAT TO DO AND HOW TO CHANGE IT... div = $(div style='display:none'blah/div) jcarousel.find(img) .hover( function(){ div.css({display:'block',position:'absolute',left:$(this).offset ().left, top:$(this).offset().top+$(this).height()}); $(document.body).appendChild(div); }, function(){ div.css({display:'none'}); }); OR IF YOU CAN, show me how to implement this bit, I will so greatfull. Since theimageelements are sort of dynamic it might be better to use live events with mouseover/mouseout, or mousemove Thnak you again for your time. Hugo On Apr 10, 8:22 pm, jay jay.ab...@gmail.com wrote: If you want it directlybelowtheimagethe easiest thing to do would be to position it absolutely to this position when you hover over theimage. Something like this might work: div = $(div style='display:none'blah/div) jcarousel.find(img) .hover( function(){ div.css({display:'block',position:'absolute',left:$(this).offset ().left, top:$(this).offset().top+$(this).height()}); $(document.body).appendChild(div);}, function(){ div.css({display:'none'}); }); Since theimageelements are sort of dynamic it might be better to use live events with mouseover/mouseout, or
[jQuery] Re: help with an IE bug: marginTop
if(op.vertical) { cssProp.height = height; cssProp.top = '50%'; cssProp.marginTop = halfHeight; } I did try changing the line to: cssProp.margin-top = halfHeight; ... but that tosses up a syntax error.
[jQuery] Calling function in document ready?
I have a function within the $(document).ready(function() { function myFunction(){ } )); But I want to call it from Flash? What name should I use? jQuery.myFunction does not seem to work..
[jQuery] Re: Calling function in document ready?
why aren't you putting myFunction outside of .ready()? On May 4, 12:06 am, Mech7 chris.de@gmail.com wrote: I have a function within the $(document).ready(function() { function myFunction(){ } )); But I want to call it from Flash? What name should I use? jQuery.myFunction does not seem to work..
[jQuery] I need the solution for my edit in the place
The below code which display the username from the user table, When i click the username , then that particular user firstname will be display , Now i want to edit that particular person firstname , How to do that with jquery , html titleJofire Contacts/title head style type=text/css li{ list-style:none; color:#0033FF; cursor:pointer; } /style script src=jquery.js type=text/javascript/script script type=text/javascript src=demo.js/script script type=text/javascript function showDetails(id) { $.ajax({ type: POST, url: showdetails.php, data: id= + id , success: function(html){ $('#test').html(html); } }); } /script /head body ?php mysql_connect(localhost,root,admin); mysql_select_db(test); ? ?php $query = SELECT first_name,id FROM mantis_contacts_ameex; $result = mysql_query($query); ? ul ? while($row = mysql_fetch_object($result)){ $contact_id = $row-id; print li onClick=showDetails($contact_id) .$row-first_name./li; } //onClick=showDetails($contact_id) ? /ul div id=test/div /body /html -- உங்கள் நண்பன் பரணி குமார் Regards B.S.Bharanikumar POST YOUR OPINION http://bharanikumariyerphp.site88.net/bharanikumar/
[jQuery] Re: Calling function in document ready?
Because there is a property.. which another function sets for a login panel, which changes the height...(in html) I am resizing the flash object accordingly. So i need access to this aswell.. On May 4, 11:07 am, MorningZ morni...@gmail.com wrote: why aren't you putting myFunction outside of .ready()? On May 4, 12:06 am, Mech7 chris.de@gmail.com wrote: I have a function within the $(document).ready(function() { function myFunction(){ } )); But I want to call it from Flash? What name should I use? jQuery.myFunction does not seem to work..
[jQuery] Re: Calling function in document ready?
Hmm.. without more code to show, that doesn't make much sense... but anyways doing something like var M7 = {};//Global variable accessible to all $(document).ready(function() { M7.function = myFunction() { }; }); You can now say call: M7.myFunction(); from anywhere on the page *after* $(document).ready () fires On May 4, 12:18 am, Mech7 chris.de@gmail.com wrote: Because there is a property.. which another function sets for a login panel, which changes the height...(in html) I am resizing the flash object accordingly. So i need access to this aswell.. On May 4, 11:07 am, MorningZ morni...@gmail.com wrote: why aren't you putting myFunction outside of .ready()? On May 4, 12:06 am, Mech7 chris.de@gmail.com wrote: I have a function within the $(document).ready(function() { function myFunction(){ } )); But I want to call it from Flash? What name should I use? jQuery.myFunction does not seem to work..
[jQuery] Re: Calling function in document ready?
Yeah thanks... I just did that as a work around... But am still wondering if there is any cleaner way to handle this :D On May 4, 11:32 am, MorningZ morni...@gmail.com wrote: Hmm.. without more code to show, that doesn't make much sense... but anyways doing something like var M7 = {}; //Global variable accessible to all $(document).ready(function() { M7.function = myFunction() { }; }); You can now say call: M7.myFunction(); from anywhere on the page *after* $(document).ready () fires On May 4, 12:18 am, Mech7 chris.de@gmail.com wrote: Because there is a property.. which another function sets for a login panel, which changes the height...(in html) I am resizing the flash object accordingly. So i need access to this aswell.. On May 4, 11:07 am, MorningZ morni...@gmail.com wrote: why aren't you putting myFunction outside of .ready()? On May 4, 12:06 am, Mech7 chris.de@gmail.com wrote: I have a function within the $(document).ready(function() { function myFunction(){ } )); But I want to call it from Flash? What name should I use? jQuery.myFunction does not seem to work..
[jQuery] Safari AJAX problem
Hi I have issues with Safari that AJAX page disappears after load and also C# page methods does not load. BUT if i choose from the Safari menu: Develop - User Agent - any other windows client (Firerox or IE) then it works Ok!!! My question - can I control this from Javascript - i mean to change this settings in the client browser or any other solution thanks Alex
[jQuery] Re: plugin does not validate form at all...
Sorry, the above code did not have any metadata. I tried it with the rule specification and it works when both the file and text elements are missing. But then when I enter the value for one of them and hit Submit, the form gets submitted. I am not sure what I am doing wrong... Please let me know what i am doing wrong... thanks! $(#uploadform).validate({ rules: { id11: { required: true, depends: function(element) {return $(#id1).is(':visible') } }, id12: { required: true, depends: function(element) {return $(#id2).is(':visible') } }, text1: { required: true, depends: function(element) {return $(#id1).is(':visible') } }, text2: { required: true, depends: function(element) {return $(#id2).is(':visible') } }, file1: { required: true, depends: function(element) {return $(#id1).is(':visible')} }, file2: { required: true, depends: function(element) {return $(#id2).is(':visible') } } } } ); On May 3, 6:54 pm, ecognium ecogn...@gmail.com wrote: Hi All, I am trying to use the validate plugin to validate a form but it does not work..Could you please let me know what i am doing wrong? The page starts with a simple drop down asking for the user to choose a category. Once the category is chosen, a div block becomes visibile. WHen the user clicks submits the form, I would like to validate the form only for the visible elements. Since I was trying to figure out how to use the validate plugin i was just calling the plain .validate() call without any rules.. even that does not work.. I also tried removing the category selection and kept all the form elements visible.. even then I was able to get it to work... I am attaching the HTML code with the jquery validate call.. could you please let me know what i should do to make this work? Thanks! code !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; html xmlns=http://www.w3.org/1999/xhtml; head title Validate /title meta http-equiv=Content-type content=text/html;charset=UTF-8 / script type=text/javascript src=include/jquery-1.3.2.min.js/ script script type=text/javascript src=include/ jquery.validate.pack.js/script script type=text/javascript !-- $(document).ready(function() { $(#uploadform).validate(); $('#id1').hide(); $('#id2').hide(); if ($('#category').val() == 'v1') $('#id1').show(); else if ($('#category').val() == 'v2') $('#id2').show(); $('#category').change(function() { if ($(this).val() == 'none') { $('#id1').hide(); $('#id2').hide(); } else if ($(this).val() == 'v1') { $('#id1').show(); $('#id2').hide(); } else if ($(this).val() == 'v2') { $('#id1').hide(); $('#id2').show(); } }); }); // -- /script /head body div id=categ-container div id=categ-content div pSelect your category to get started. /p label Category /label select id=category option value=none /option option value=v1 V1 /option option value=v2 V2 /option /select p/pp/p /div form id=uploadform method=post action=# div id=id1 table border=0 trtdlabel Location /label /td tdinput type=file name=file1//td/tr trtdlabel Cat1 /label /td td select id=id11 name=cat1 option value=v1 Value1 /option option value=v2 Value2 /option
[jQuery] Re: plugin does not validate form at all...
Sorry :( made a typo in the above code.. here is the right version.. $(#uploadform).validate({ rules: { id11: { required: true, depends: function(element) {return $(#id1).is(':visible') } }, id12: { required: true, depends: function(element) {return $(#id1).is(':visible') } }, text1: { required: true, depends: function(element) {return $(#id1).is(':visible') } }, file1: { required: true, depends: function(element) {return $(#id1).is(':visible')} }, id21: { required: true, depends: function(element) {return $(#id2).is(':visible') } }, text2: { required: true, depends: function(element) {return $(#id2).is(':visible') } }, file2: { required: true, depends: function(element) {return $(#id2).is(':visible') } } } } ); On May 3, 10:34 pm, ecognium ecogn...@gmail.com wrote: Sorry, the above code did not have any metadata. I tried it with the rule specification and it works when both the file and text elements are missing. But then when I enter the value for one of them and hit Submit, the form gets submitted. I am not sure what I am doing wrong... Please let me know what i am doing wrong... thanks! $(#uploadform).validate({ rules: { id11: { required: true, depends: function(element) {return $(#id1).is(':visible') } }, id12: { required: true, depends: function(element) {return $(#id2).is(':visible') } }, text1: { required: true, depends: function(element) {return $(#id1).is(':visible') } }, text2: { required: true, depends: function(element) {return $(#id2).is(':visible') } }, file1: { required: true, depends: function(element) {return $(#id1).is(':visible')} }, file2: { required: true, depends: function(element) {return $(#id2).is(':visible') } } } } ); On May 3, 6:54 pm, ecognium ecogn...@gmail.com wrote: Hi All, I am trying to use the validate plugin to validate a form but it does not work..Could you please let me know what i am doing wrong? The page starts with a simple drop down asking for the user to choose a category. Once the category is chosen, a div block becomes visibile. WHen the user clicks submits the form, I would like to validate the form only for the visible elements. Since I was trying to figure out how to use the validate plugin i was just calling the plain .validate() call without any rules.. even that does not work.. I also tried removing the category selection and kept all the form elements visible.. even then I was able to get it to work... I am attaching the HTML code with the jquery validate call.. could you please let me know what i should do to make this work? Thanks! code !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; html xmlns=http://www.w3.org/1999/xhtml; head title Validate /title meta http-equiv=Content-type content=text/html;charset=UTF-8 / script type=text/javascript src=include/jquery-1.3.2.min.js/ script script type=text/javascript src=include/ jquery.validate.pack.js/script script type=text/javascript !-- $(document).ready(function() { $(#uploadform).validate(); $('#id1').hide(); $('#id2').hide(); if ($('#category').val() == 'v1') $('#id1').show(); else if ($('#category').val() == 'v2') $('#id2').show(); $('#category').change(function() { if ($(this).val() == 'none') { $('#id1').hide(); $('#id2').hide();