[jQuery] Re: alter the font size of a dynamic header?
derek allard wrote: Hello. We are working within a CMS and we have a dynamic text header that pulls into the top of the page. The problem is that there are certain titles that are too long and are breaking into other design elements. I'm thinking there should be a way to count the number of characters and then dynamically change the font-size of the header. 1. Is this possible? 2. Can you point me in the right direction? Thanks. derek Unless you're using a monospace font the approach of counting characters will fail due to the differences in width between characters. I think a better way is to find out the width of a certain element using $('#title').width(), and then just make the font size smaller until it fits (with a loop or something). Jonathan -- Jonathan Vanherpe - Tallieu Tallieu NV - jonat...@tnt.be
[jQuery] Re: Announce = ChessTwit now using jQuery
oh I forgot the link !! = www.chesstwit.com You can play chess with all your twitter friends. On 26 Oct, 16:13, weepy jonah...@gmail.com wrote: Hey there, Just wanted to tell everyone about ChessTwit that's using jQuery to good effect. The best place to play correspondence chess with your friends on Twitter. Log in and get playing! Hope you like ! Cheers @weepy
[jQuery] Re: how jquery handle the redirect quest from server(php)?
As far as I'm aware xhr already follows redirections, and complete isn't triggered before the final destination is reach (which makes it a lot easier to ajax a restful app). There is a callback you can set in xhr objects to handle partial loading events, though I haven't seen the point in using them in my everyday coding life right now. Michel Belleville 2009/10/27 Loy nirvanaf...@gmail.com Hi everyone: I just started to learn jquery and met this problem: I would like to use .ajax to send a http request. For example: I got the code like the following $.ajax( { type:GET, url:./include/coor_generator.php, complete:function (xhr,statusText) { alert(xhr.status); } } ); However, in 'coor_generator.php', I would like to verify if that user session is already verified or not, so that the content of 'coor_generator.php' is like: ?php require_once(session.php); require_once(DB.php); //DB class declartion $status_code = 1; header(Content-type: text/xml); header(Cache-Control: no-cache); echo ?xml version=\1.0\?\n; echo response\n; echo \tstatus$status_code/status\n; .. ? in 'session.php', the content is: ?php session_start(); setcookie(session_name(), session_id(), time() + 1*60, /); if(!(isset($_SESSION[username]))||!(isset($_SESSION [password]))) { header(Refresh:0;url=./login.php); exit(0); } ? However, as I tested the script in Firebug, the returned xhr.status (in .ajax complete option) is always 200. Isn't it supposed to be 301 for redirection? My objective is very simple: if the user is verified, coor_generator.php generate some x,y coordinates in a valid XML format; however, if the user is not verified, redirect the user to the login page. How to achieve this using Jquery AJAX? Thanks a lot!!!
[jQuery] Re: Question regarding image grid
Depending on your clients navigators you may use inline-block positionning (works fine with Firefox 3.xx, Opera, Safari ; works with Firefox 2.xx with a few tweaks, works IE7 with a bit more tweaking but ultimately ok), or floating positioning if you really are forced to be IE6 compliant (though that'll probably be a massive headache to get it working fine). Michel Belleville 2009/10/27 Arunkumar Puppala puppala.arunku...@gmail.com Hi all, I am trying to build an application that displays the images in the form of a grid. We get the total number of images and number of images displayed on a page through a cgi parameter. Can someone suggest me how to build such an image grid with pagination controls? Thanks, Arun
[jQuery] Re: jQuery UI draggable
By reading the doc a lot of answers one can find, hmm... http://docs.jquery.com/UI/Draggable#option-handle To master jquery, master the api you must. Michel Belleville 2009/10/27 Thai Dang Vu tdan...@gmail.com Suppose that I have this div div id='draggable' div id='header'x/div div id='content'zzz/div /div I use jQuery UI draggable to make the div 'draggable' draggable $('#draggable').draggable(); Then I can press the mouse anywhere in the 'draggable' div and drag that div. Now I want to drag the 'draggable' div only when I press the mouse on the 'header' div. How can I do that? Thank you.
[jQuery] Re: take 3 values at time for fade in fade out effect.
Solved my problem. here is the link which helped me to do so. http://tweet.seaofclouds.com/ I hope this ll help someone. :) On Oct 27, 9:50 am, deep deeps...@gmail.com wrote: please see this example http://tweet.seaofclouds.com/ in the first demo they are showing 3 tweets. but its not ticker so i just want it should keep on moving. here is similar demo which i am doing with fade in fade out effet they are showing 1 tweet at a time. but i want to show 3 tweets at time. http://www.moretechtips.net/2009/09/realtime-related-tweets-bar-anoth... How can i do that? :( On Oct 27, 9:26 am, deep deeps...@gmail.com wrote: Hello rick, here is my code. you need to run this file tweet.php base target=_blank style body { margin:0; padding: 0; background-color: transparent; } div#feed-ticker{ width:780px; display:block; min-height:82px; height:auto !important; height:84px; margin:0; padding:0; background:url(../images/bird.jpg) no-repeat 100% 100%; } div#feed-ticker ul{ list-style:none; width:780px; display:block; height:80px; font-family: Arial, serif; font-size: 110%; font-weight:normal; overflow:hidden; margin:0px 0 0 0; padding:0; } div#feed-ticker ul li{ list-style:none; width:780px; display:block; height:80px; font-family: Arial, serif; font-size: 110%; font-weight:normal; line-height:16px; overflow:hidden; margin:0px 7px 0 0; padding:9px 0!important; padding:13px 0; } div#feed-ticker ul li a{ color:#013366; } div#feed-ticker ul li a:hover{ color:#013366; text-decoration:underline; } /* for twitter feeds */ .query { font-family: Arial, serif; font-size: 90%; width:780px; } .query .tweet_list { list-style-type: none; margin: 0; padding: 0; } .query .tweet_list li { padding: .5em; } .query .tweet_list li a { } .query .tweet_list .tweet_even { } .query .tweet_list .tweet_avatar { border:1px solid #808080; padding: .2em; float: left; margin:0 5px 0 0; } .query .tweet_list .tweet_avatar img { vertical-align: middle; } div#feed-ticker ul li p a { color: #8F6F00; font-size:65%; line-height:4px; text-decoration: none; } div#feed-ticker ul li p a:hover { color: #8F6F00; font-size:65%; line-height:4px; text-decoration: underline; } /style script language=javascript src=http://ajax.googleapis.com/ajax/ libs/jquery/1.3.1/jquery.min.js type=text/javascript/script script language=javascript src=jquery-twitter.js type=text/ javascript/script script type='text/javascript' jQuery(document).ready(function($) { $(.query).tweet({ avatar_size: 48, count: 50, query: %Goodnight, // you can put here anything hash field loading_text: Loading twitter conversations... }); }) /script script type=text/javascript src=scripts/jsapi/script script type=text/javascriptgoogle.load(jquery, 1.2.6);/ script script type=text/javascript src=sample.js/script script type=text/javascript google.setOnLoadCallback( initNews ); /script div id=feed-ticker class=query /div this is jquery-twitter.js (function($) { $.fn.tweet = function(o){ var s = { username: [seaofclouds], // [string] required, unless you want to display our tweets. :) it can be an array, just do [username1,username2,etc] avatar_size: null, // [integer] height and width of avatar if displayed (48px max) count: 3, // [integer] how many tweets to display? intro_text: null, // [string] do you want text BEFORE your your tweets? outro_text: null, // [string] do you want text AFTER your tweets? join_text: null, // [string] optional text in between date and tweet, try setting to auto auto_join_text_default: i said,, // [string] auto text for non verb: i said bullocks auto_join_text_ed: i,
[jQuery] Cloning a table row and changing its form field IDs
Hi everyone. I'm writing a dynamic form that allows users to add fields. These fields are contained in a table. I have this function to clone the rows (my table has an ID of EventType) function addEventType() { var clonedRow = $(#EventType tr:last).clone(); $(input, clonedRow).attr('value', ''); // reset the form values $(input:checked, clonedRow).attr('checked', ''); // uncheck any checked boxes $(#EventTypeID).append(clonedRow); $(.datepicker).datepicker(); // reset the datepicker widget $(.datepicker).removeClass('hasDatepicker').datepicker(); } This gets more complicated because I'm using a Datepicker - this needs each input using the widget to have a unique ID. I've tried for a few hours now to find some way to give the cloned row's inputs unique IDs, but I'm getting nowhere. I tried setting a hidden form field that counted the current ID, then incremented it for the new rows, but I can't seem to get this to work. Can anyone point me in the right direction for incrementing the IDs of the fields that are cloned? My HTML looks like this for each row: tr tdinput type=text name=Title //td tdinput type=text class=datepicker size=11 id=picker_1 / /td tdinput type=text class=datepicker size=11 id=picker_2 / /td tdinput type=checkbox name=Active //td /tr Matt
[jQuery] Re: AJAX and JSON
On Mon, Oct 26, 2009 at 9:58 PM, MorningZ morni...@gmail.com wrote: if this is your *exact* code $.getJSON(url + ?callback?, function (json) { then you're missing an equal sign $.getJSON(url + ?callback=?, function (json) { Good catch! Fortunately I had the = in my real code. I just forgot to type it in the email. As for the rest of your issue of what to do, this post should help: http://groups.google.com/group/jquery-en/browse_thread/thread/fd821bf488c9a9d3?hl=en# Okay, I think I understand about using jsonp now. I don't think I need it in my case though because my call isn't cross-site. So I still have these questions: 1) What should the response type be when using jsonp? 2) What should the response type be when not using jsonp? Is that just called plain json? 3) When not using jsonp, what should the server code return? Still JavaScript code that calls the callback function with the json content or just the json content? On Oct 26, 8:14 pm, Mark Volkmann r.mark.volkm...@gmail.com wrote: I have some code working that invokes an HTTP service that returns JSON. From my JavaScript I call the service with: $.getJSON(url + ?callback?, function (json) { // do something with json here }); My service is implemented as a Java servlet with a doGet method. In that method I: 1) set the content type of the response to application/x-javascript. 2) get the value of the callback parameter 3) create a Java Map 4) use the org.json library to convert the map to JSON text 5) build a string of JavaScript code that calls the callback function, passing it the JSON 6) write the string of JavaScript to the response Is this the recommended approach? I was expected that I wouldn't need to pass the callback function name to the servlet and could just return the JSON from the servlet instead of a string of JavaScript code. -- R. Mark Volkmann Object Computing, Inc.
[jQuery] How to do refresh only when new tweet is added.
Hello I have scripts which refreshes my file after few seconds. but i want it should refreshes only when that file is got new data(new tweets) index.php script $(document).ready(function() { $(#responsecontainer).load(index-tweet.php); var refreshId = setInterval(function() { $(#responsecontainer).load('index-tweet.php?randval='+ Math.random()); }, 8000); }); /script index-tweet.php !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http:// www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd html head titleTweet! Put Twitter on your site with this simple, unobtrusive jQuery widget/title link href=jquery.tweet.css media=all rel=stylesheet type=text/css/ link href=jquery.tweet.query.css media=all rel=stylesheet type=text/css/ !-- script language=javascript src=http://ajax.googleapis.com/ ajax/libs/jquery/1.3.1/jquery.min.js type=text/javascript/script -- script language=javascript src=jquery.tweet.js type=text/ javascript/script script type='text/javascript' jQuery(document).ready(function($) { $(.tweet).tweet({ join_text: auto, username: 23nasscompc, avatar_size: 48, count: 3, auto_join_text_default: we said,, auto_join_text_ed: we, auto_join_text_ing: we were, auto_join_text_reply: we replied, auto_join_text_url: we were checking out, loading_text: loading tweets... }); $(#query).tweet({ avatar_size: 32, count: 3, query: %Halloween , loading_text: searching twitter... }); }) /script /head body div class='container' can anyone please tell me how can i do that? div id=query class='query'/div /div /body /html
[jQuery] Re: Sort columns with URL in Tablesort
Here is example of table presently working on. I using the code below, but getting error message: $(document).ready(function() { // call the tablesorter plugin $(table).tablesorter({ // define a custom text extraction function textExtraction: function(node) { // extract data from markup and return it return node.childNodes[0].childNodes[0].innerHTML; } }); }); Error: node.childNodes[0].childNodes[0] is undefined Example row: td54/tdtd34/tdtda hred='something' target='_blank'blah/ a/td On Oct 26, 6:55 pm, ChaosAD chao...@gmail.com wrote: Thanks, I will tomorrow when back at work. Right now it is data in td themselves and links inside as well. I want to make it flexable though so it can handle other types such as em etc. On Oct 26, 6:26 pm, MorningZ morni...@gmail.com wrote: Perhaps post an example of the table's HTML and it would (much) easier to help as your first post mentioned a tags and you implied it was nothing but those, now you have em or no tag at all, quite a bit more complicated now On Oct 26, 4:45 pm, ChaosAD chao...@gmail.com wrote: Thanks for the reply. My problem is rising from the fact that not all column are url based. Some are straight data and some others might have other tags such as em around them. I tried following the example for custom parser and I kept getting s integer errors. Sorry if this is simple problem, I am very nice to jquery and especially tablesort. On Oct 26, 4:36 pm, MorningZ morni...@gmail.com wrote: You'll need to write a custom Parser so that you get what's inside the a tag and not the string itself... It's very easy to do if you just follow his example on the site On Oct 26, 3:00 pm, ChaosAD chao...@gmail.com wrote: I'm fairly new to Tablesort, but got it working for the most part. The only problem I have is any columns that have a a href/a in them. It seems to sort it based on the url and not that actual data in the cell. How do I get it to sort based on the data and not the url?
[jQuery] Re: Cloning a table row and changing its form field IDs
Never mind - Ricardo's genius post here solved it for me: http://groups.google.com/group/jquery-en/browse_thread/thread/f5469902b151daa2/b1908e69d723bfa6?lnk=gstq=clone+IDs#b1908e69d723bfa6 On Oct 27, 10:43 am, Matt guitarroman...@gmail.com wrote: Hi everyone. I'm writing a dynamic form that allows users to add fields. These fields are contained in a table. I have this function to clone the rows (my table has an ID of EventType) function addEventType() { var clonedRow = $(#EventType tr:last).clone(); $(input, clonedRow).attr('value', ''); // reset the form values $(input:checked, clonedRow).attr('checked', ''); // uncheck any checked boxes $(#EventTypeID).append(clonedRow); $(.datepicker).datepicker(); // reset the datepicker widget $(.datepicker).removeClass('hasDatepicker').datepicker(); } This gets more complicated because I'm using a Datepicker - this needs each input using the widget to have a unique ID. I've tried for a few hours now to find some way to give the cloned row's inputs unique IDs, but I'm getting nowhere. I tried setting a hidden form field that counted the current ID, then incremented it for the new rows, but I can't seem to get this to work. Can anyone point me in the right direction for incrementing the IDs of the fields that are cloned? My HTML looks like this for each row: tr tdinput type=text name=Title //td tdinput type=text class=datepicker size=11 id=picker_1 //td tdinput type=text class=datepicker size=11 id=picker_2 //td tdinput type=checkbox name=Active //td /tr Matt
[jQuery] Re: cluetip memory leak
thanks for that explanation, Dave. --Karl On Oct 26, 2009, at 7:54 PM, Dave Methvin wrote: I think a lot of plugins have this problem but most people aren't creating and deleting them a lot. My splitter has this issue but I solved that problem because I was too lazy to support splitters being destroyed. See, the real problem is that you have a destroy option! :-) Since $this and other vars like $cluetip are being used within several of the event handlers by closure, the jQuery (and DOM) objects they contain are kept alive. You can't delete or null them out because they're used while the cluetip is active. Those handlers would need to be rewritten to use the local this instead and I think the handlers need to be declared outside the .each() function scope. You'd have to do the same with all the other cached variables like $cluetip as well. In addition to destroy detaching all the event handlers, it should remove any .data() or .metadata() that was put onto the element. The jQuery UI widgets have a destroy pattern, you can see how they do it. I also see a leak like the one discussed here: http://groups.google.com/group/jquery-dev/browse_frm/thread/2b1981f7530dedde# If you use any modifying operation in a chain and save the later part of the chain in a variable, the older part of the chain is still referenced by jQuery's .prevObject property. I can see some of those in the cluetip plugin: $dropShadow = $([]); for (var i=0; i dropShadowSteps; i++) { $dropShadow = $dropShadow.add($('div/div').css({zIndex: cluezIndex-1, opacity:.1, top: 1+i, left: 1+i})); }; The .add() method creates a new object each time through the loop but the older objects are retained as a chain of .prevObject properties leading from the jQuery object held by the final $dropShadow variable. As long as the $dropShadow variable goes out of scope when the function is done at the end of the .each() call to that function, it should be reclaimed. At the moment $dropShadow is kept alive by the cluetipshow event handler so the whole chain can't be garbage collected.
[jQuery] Ajax enabled Links/Forms and AutoRefresh
I'm looking for following ajax functionaliaties. Can you please point me to some example or correct page in documentation. 1- Ajax enabled Link (a) that on click fetch data from server (database) and refresh an area of page with new data 2- Ajax enabled form, that on submit does same as above in point#1 3- Automatically sends an ajax call to server after given number of seconds, gets data from server(database) and refresh a area on page. Just like pop-up alerts used by Outlook
[jQuery] Re: Question regarding image grid
I think I've done something similar to this. What I did (for a one-row image grid with horizontal scrolling) was have a div with a fixed height and width, overflow: hidden, and position:relative. I put a child div with absolute positioning and a large enough width so that it will accommodate all child image elements in one row. Finally, I put all the child image elements in this div, with the restriction that all images have the same width and height. Two scrolling buttons with click events attached to them are used to scroll left or right, which is done by changing the left property of the div with absolute positioning. Ex: The HTML: img class=galleryNav left alt=left arrow src=leftArrow.gif / div class=thumbnail-container div class=thumbnail-scroll img src='1.gif'/img img src='2.gif'/img ... img src='40.gif'/img /div /div img class=galleryNav right src=rightArrow.gif/ With the CSS: .thumbnail-container { height: 100px; width: 800px; position: relative; overflow: hidden; } .thumbnail-scroll { position: absolute; width: 4200px; /* a little more than needed */ } .thumbail-scroll img { height:100px; width:100px; } and a sample javascript: $('.left').click(function() { $('.thumbnail-scroll').animate({left: -=100px}, 500); // animated scrolling }); $('.right').click(function() { $('.thumbnail-scroll').animate({left: +=100px}, 500); }); To extend it to a grid you could change the height and with values of both divs. Also note that the img tags should really have alt attributes. On Oct 26, 8:41 pm, Arunkumar Puppala puppala.arunku...@gmail.com wrote: Hi all, I am trying to build an application that displays the images in the form of a grid. We get the total number of images and number of images displayed on a page through a cgi parameter. Can someone suggest me how to build such an image grid with pagination controls? Thanks, Arun
[jQuery] Submenu's
Ok ive tried like everything, my content areas are overlaping with my submenus, and ive probly set every single functions z-index to 10 in the superfishmenu's css. Ive even set the content areas thats overlaping with my submenu to -z-index Any1 got another idee, im really clueless now, and i really want this to work :( its exactly what i need! Thanks
[jQuery] Re: Accessing jCarousel outside of the callback...
When you're binding the itemLoadCallback, you have a state argument. this argument contains the 'init' string at initialisation. you could catch the jCarousel argument (that is what you want) at initialisation, and then use it later. var myCarousel; function itemLoad(carousel, state) { if(state == 'init') { myCarousel = carousel; return; } /* ... */ return; }; jQuery(function() { jQuery('#carousel-selector').jcarousel({ itemLoadCallback: itemLoad, options: }); }); Cya. On 22 oct, 18:34, Karega karega.mc...@gmail.com wrote: Is there anyway that I can access the specific carousels of an element outside the callback function? i.e. jQuery(#id).jcarousel.scroll(3);
[jQuery] blockUI cursor bug when overlayCSS backgroundColor is empty/transparent
I know there's already a couple of posts about IE cursor issues, but this one is slightly different I think. If you set the overlayCSS backgroundColor property to an empty string or 'transparent', IE will not change the cursor when blocking the UI. E.g. $.blockUI({ message: null, overlayCSS: { backgroundColor: '' }, fadeIn: 0, fadeOut: 0 }); The above will not change the cursor in IE. I have worked round this by setting the overlay properties to white with zero opacity instead, which does produce the correct cursor behaviour: $.blockUI({ message: null, overlayCSS: { backgroundColor: '#fff', opacity: 0 }, fadeIn: 0, fadeOut: 0 }); I guess this is more of a tip for anyone else who encounters the same issue.
[jQuery] Improvements jQuery.support
I found this website which has done a great job writing some detection functions for some of the new html5 capabilities. Perhaps this is something that could be added to jQuery.support? I don't know the policies for inclusions, perhaps it's something you rather see people include themselves. However, I thought I'd post a notice here in case it hasn't been discovered already: http://diveintohtml5.org/detect.html#input-types one example: function supports_input_placeholder() { var i = document.createElement('input'); return 'placeholder' in i; }
[jQuery] jQuery plugins seem not working after the back of the browser only with Safari and Google Chrome
Hi everyone, In my web page I have the following code: In the head part the loading of jQuery library and a jQuery plugin named jquery.queryNickName: script type=text/javascript src=http://lib.community.virgilio.it/ js/lib/std/jquery/jquery-1.3.2.min.js/script script type='text/javascript' src='http://lib.community.virgilio.it/ js/lib/mtx/jquery/jquery.queryNickName/jquery.queryNickName-last- min.js'/script script type=text/javascript src=/myvirgilio/js/index.js/script In index.js javascript file I call the plugin in this way: $(document).ready(function(){ $('.queryNickName').queryNickName( {callback : function(nickname) { $(.queryNickNameLink).attr(href, http://people.virgilio.it/ profilo/ + nickname); }}); }); The plugin is applied to this div inside the body of the html page: div class=profile h4CIAO a class=nick queryNickNameNick/a/h4 div class=profile_btn pa class=queryNickNameLink title=VAI AL TUO PROFILOVAI AL TUO PROFILO/a/p /div /div When the page is loaded for the first time, the plugin works correctly with all browsers. Problems arise when I subsequently navigate to another web page and then I go back to the first page. After the back of the browser, the page is loaded but the plugin doesn't work anymore. This strange effect happens only with Safari and Google Chrome. In Firefox and IE it all works correctly. If I use Chrome debugger, I get the following message ONLY AFTER the back of the browser and NOT the first time the page is loaded: Uncaught TypeError: Object #an Object has no method 'queryNickName' It seems that the second time, only after the back button, the jquery library is reloaded and I loose the binding between the plugin and the library. How can I resolve this problem? Thanks a lot. Federico
[jQuery] Re: Improvements jQuery.support
I found this website which has done a great job writing some detection functions for some of the new html5 capabilities. Perhaps this is something that could be added to jQuery.support? I added your find to an open ticket on HTML5 issues, thanks! http://dev.jquery.com/ticket/4668
[jQuery] Re: AJAX and JSON
yeah, if you are not using cross domain calls, dump the callback parameter there, it's totally no needed... and if you are not using cross domain, then you aren't/don't-need-to use or think about jsonp at all as for mime type of normal json: application/json or text/plain also works for fine (in my experiences anyways) On Oct 27, 6:49 am, Mark Volkmann r.mark.volkm...@gmail.com wrote: On Mon, Oct 26, 2009 at 9:58 PM, MorningZ morni...@gmail.com wrote: if this is your *exact* code $.getJSON(url + ?callback?, function (json) { then you're missing an equal sign $.getJSON(url + ?callback=?, function (json) { Good catch! Fortunately I had the = in my real code. I just forgot to type it in the email. As for the rest of your issue of what to do, this post should help: http://groups.google.com/group/jquery-en/browse_thread/thread/fd821bf... Okay, I think I understand about using jsonp now. I don't think I need it in my case though because my call isn't cross-site. So I still have these questions: 1) What should the response type be when using jsonp? 2) What should the response type be when not using jsonp? Is that just called plain json? 3) When not using jsonp, what should the server code return? Still JavaScript code that calls the callback function with the json content or just the json content? On Oct 26, 8:14 pm, Mark Volkmann r.mark.volkm...@gmail.com wrote: I have some code working that invokes an HTTP service that returns JSON. From my JavaScript I call the service with: $.getJSON(url + ?callback?, function (json) { // do something with json here }); My service is implemented as a Java servlet with a doGet method. In that method I: 1) set the content type of the response to application/x-javascript. 2) get the value of the callback parameter 3) create a Java Map 4) use the org.json library to convert the map to JSON text 5) build a string of JavaScript code that calls the callback function, passing it the JSON 6) write the string of JavaScript to the response Is this the recommended approach? I was expected that I wouldn't need to pass the callback function name to the servlet and could just return the JSON from the servlet instead of a string of JavaScript code. -- R. Mark Volkmann Object Computing, Inc.
[jQuery] Re: Submenu's
probably an easy fix but not without a link to see it...is this a joomla pillmenu? cooli wrote: Ok ive tried like everything, my content areas are overlaping with my submenus, and ive probly set every single functions z-index to 10 in the superfishmenu's css. Ive even set the content areas thats overlaping with my submenu to -z-index Any1 got another idee, im really clueless now, and i really want this to work :( its exactly what i need! Thanks
[jQuery] Re: Ajax enabled Links/Forms and AutoRefresh
http://lmgtfy.com/?q=jquery+ajax Michel Belleville
[jQuery] How to check if a DIV with ID xyz exist?
Hi, how can i check if a DIV with the ID xyz exist? thank you yavuz
[jQuery] Re: How to check if a DIV with ID xyz exist?
if (document.getElementById(xyz)) { // exists } else { // does not exist } or, if you must use jQuery for whatever reason (which would ultimately use the above anyways) if ($(#xyz).length 0) { // exists } else { // does not exist } On Oct 27, 9:37 am, bc04Inc. bc04...@googlemail.com wrote: Hi, how can i check if a DIV with the ID xyz exist? thank you yavuz
[jQuery] Re: How to check if a DIV with ID xyz exist?
I have now found this one: if ($('#toc').length) { } is this correct, too? On 27 Okt., 14:39, MorningZ morni...@gmail.com wrote: if (document.getElementById(xyz)) { // exists} else { // does not exist } or, if you must use jQuery for whatever reason (which would ultimately use the above anyways) if ($(#xyz).length 0) { // exists} else { // does not exist } On Oct 27, 9:37 am, bc04Inc. bc04...@googlemail.com wrote: Hi, how can i check if a DIV with the ID xyz exist? thank you yavuz- Zitierten Text ausblenden - - Zitierten Text anzeigen -
[jQuery] Re: How to check if a DIV with ID xyz exist?
As correct as 0 == false et 1..oo == true Michel Belleville 2009/10/27 bc04Inc. bc04...@googlemail.com I have now found this one: if ($('#toc').length) { } is this correct, too? On 27 Okt., 14:39, MorningZ morni...@gmail.com wrote: if (document.getElementById(xyz)) { // exists} else { // does not exist } or, if you must use jQuery for whatever reason (which would ultimately use the above anyways) if ($(#xyz).length 0) { // exists} else { // does not exist } On Oct 27, 9:37 am, bc04Inc. bc04...@googlemail.com wrote: Hi, how can i check if a DIV with the ID xyz exist? thank you yavuz- Zitierten Text ausblenden - - Zitierten Text anzeigen -
[jQuery] How to access a JavaScript object from within an ajax call?
I am trying to access my own JS object from within an ajax call, and can't figure out how to get it to work. Whenever I access this in the function, it returns the ajax context and not my JS object context. My code looks something like this. I have a Zone object defined in a JS file like this: //START CODE function Zone(data){ this.someInfo = data; this.load = Zone_Load; } function Zone_Load(){ $.ajax({ type: GET, url: http://localhost/foo.xml;, success: requestSuccess }); } function requestSuccess(data){ this.someInfo = $(data).find('type'); } //ENDCODE I am having problems with the last line. How do i get access to the JS object, so that i can set some info on it, based on the ajax call? Any help would be appreciated? thx, Joe C
[jQuery] namespacing jQuery
I'm interested in namespacing jQuery to something like $myjQ. or myjQ. $ and wondering what the best way is to do it. I will potentially be using my version of jQuery on other pages that are running other versions of jQuery - hence the idea to rename it completely so that I have control over version, plugins, etc. I thought about just doing a find and replace on the word jQuery in the source, but I'm hoping there's an easier way. Thanks!
[jQuery] Re: How to check if a DIV with ID xyz exist?
I normally use the jQuery method MorningZ posted above, as it makes it easier to check for the existence of elements with a certain class name. On Oct 27, 2:05 pm, Michel Belleville michel.bellevi...@gmail.com wrote: As correct as 0 == false et 1..oo == true Michel Belleville 2009/10/27 bc04Inc. bc04...@googlemail.com I have now found this one: if ($('#toc').length) { } is this correct, too? On 27 Okt., 14:39, MorningZ morni...@gmail.com wrote: if (document.getElementById(xyz)) { // exists} else { // does not exist } or, if you must use jQuery for whatever reason (which would ultimately use the above anyways) if ($(#xyz).length 0) { // exists} else { // does not exist } On Oct 27, 9:37 am, bc04Inc. bc04...@googlemail.com wrote: Hi, how can i check if a DIV with the ID xyz exist? thank you yavuz- Zitierten Text ausblenden - - Zitierten Text anzeigen -
[jQuery] Menu flickers open
Hello, I have a Jquery enabled menu, but when the page loads, it is open for a split second.(ONLY in IE) I dont know if it a js or css problem. http://ampsoft.com/Testindex.html Thanks Mike
[jQuery] Re: namespacing jQuery
See the $.noConflict() docs: http://docs.jquery.com/Core/jQuery.noConflict var j = *jQuery.noConflict*(); // Do something with jQuery j(div p).hide http://docs.jquery.com/Effects/hide(); // Do something with another library's $() $(content).style.display = 'none'; -Dan On Tue, Oct 27, 2009 at 10:25 AM, El Greg greglaval...@gmail.com wrote: I'm interested in namespacing jQuery to something like $myjQ. or myjQ. $ and wondering what the best way is to do it. I will potentially be using my version of jQuery on other pages that are running other versions of jQuery - hence the idea to rename it completely so that I have control over version, plugins, etc. I thought about just doing a find and replace on the word jQuery in the source, but I'm hoping there's an easier way. Thanks!
[jQuery] Re: How to access a JavaScript object from within an ajax call?
Well, you're using $.ajax() and the context of its callbacks make this the xhr object, so no surprise there. This should work as you expect : var myself = this; var Zone = function(data) { myself.someInfo = data; myself.load = Zone_Load; }; var Zone_Load = function() { $.ajax({ type: GET, url: http://localhost/foo.xml;, success: requestSuccess }); }; var requestSuccess = function(data) { myself.someInfo = $(data).find('type'); }; JavaScript allows methods to access all objects contained by the context they're declared in (provided you don't declare nested variables overriding existing context variables). In this case we declare myself and give it a reference to the content of this so when this is bound to other objects we still can use myself to access the desired object. Michel Belleville 2009/10/27 Joe joecel...@gmail.com I am trying to access my own JS object from within an ajax call, and can't figure out how to get it to work. Whenever I access this in the function, it returns the ajax context and not my JS object context. My code looks something like this. I have a Zone object defined in a JS file like this: //START CODE function Zone(data){ this.someInfo = data; this.load = Zone_Load; } function Zone_Load(){ $.ajax({ type: GET, url: http://localhost/foo.xml;, success: requestSuccess }); } function requestSuccess(data){ this.someInfo = $(data).find('type'); } //ENDCODE I am having problems with the last line. How do i get access to the JS object, so that i can set some info on it, based on the ajax call? Any help would be appreciated? thx, Joe C
[jQuery] Re: Announce = ChessTwit now using jQuery
Very cool! Is this an extension of your http://64squar.es/ site? --Karl Karl Swedberg www.englishrules.com www.learningjquery.com On Oct 27, 2009, at 4:09 AM, weepy wrote: oh I forgot the link !! = www.chesstwit.com You can play chess with all your twitter friends. On 26 Oct, 16:13, weepy jonah...@gmail.com wrote: Hey there, Just wanted to tell everyone about ChessTwit that's using jQuery to good effect. The best place to play correspondence chess with your friends on Twitter. Log in and get playing! Hope you like ! Cheers @weepy
[jQuery] Re: How to access a JavaScript object from within an ajax call?
Thx!!! This is exactly what i was looking for!!! I knew there was a simple solution. Joe C On Oct 27, 11:08 am, Michel Belleville michel.bellevi...@gmail.com wrote: Well, you're using $.ajax() and the context of its callbacks make this the xhr object, so no surprise there. This should work as you expect : var myself = this; var Zone = function(data) { myself.someInfo = data; myself.load = Zone_Load;}; var Zone_Load = function() { $.ajax({ type: GET, url: http://localhost/foo.xml;, success: requestSuccess}); }; var requestSuccess = function(data) { myself.someInfo = $(data).find('type'); }; JavaScript allows methods to access all objects contained by the context they're declared in (provided you don't declare nested variables overriding existing context variables). In this case we declare myself and give it a reference to the content of this so when this is bound to other objects we still can use myself to access the desired object. Michel Belleville 2009/10/27 Joe joecel...@gmail.com I am trying to access my own JS object from within an ajax call, and can't figure out how to get it to work. Whenever I access this in the function, it returns the ajax context and not my JS object context. My code looks something like this. I have a Zone object defined in a JS file like this: //START CODE function Zone(data){ this.someInfo = data; this.load = Zone_Load; } function Zone_Load(){ $.ajax({ type: GET, url: http://localhost/foo.xml;, success: requestSuccess }); } function requestSuccess(data){ this.someInfo = $(data).find('type'); } //ENDCODE I am having problems with the last line. How do i get access to the JS object, so that i can set some info on it, based on the ajax call? Any help would be appreciated? thx, Joe C
[jQuery] Re: Sort columns with URL in Tablesort
I recently had the same problem of links sorting by the URL, but I discovered that if I removed all the white space within the cell in my HTML it would sort by the text and not the URL. I don't know if that will help you with em tags as well, but it solved the problem for links for me. On Oct 27, 7:53 am, ChaosAD chao...@gmail.com wrote: Here is example of table presently working on. I using the code below, but getting error message: $(document).ready(function() { // call the tablesorter plugin $(table).tablesorter({ // define a custom text extraction function textExtraction: function(node) { // extract data from markup and return it return node.childNodes[0].childNodes[0].innerHTML; } }); }); Error: node.childNodes[0].childNodes[0] is undefined Example row: td54/tdtd34/tdtda hred='something' target='_blank'blah/ a/td On Oct 26, 6:55 pm, ChaosAD chao...@gmail.com wrote: Thanks, I will tomorrow when back at work. Right now it is data in td themselves and links inside as well. I want to make it flexable though so it can handle other types such as em etc. On Oct 26, 6:26 pm, MorningZ morni...@gmail.com wrote: Perhaps post an example of the table's HTML and it would (much) easier to help as your first post mentioned a tags and you implied it was nothing but those, now you have em or no tag at all, quite a bit more complicated now On Oct 26, 4:45 pm, ChaosAD chao...@gmail.com wrote: Thanks for the reply. My problem is rising from the fact that not all column are url based. Some are straight data and some others might have other tags such as em around them. I tried following the example for custom parser and I kept getting s integer errors. Sorry if this is simple problem, I am very nice to jquery and especially tablesort. On Oct 26, 4:36 pm, MorningZ morni...@gmail.com wrote: You'll need to write a custom Parser so that you get what's inside the a tag and not the string itself... It's very easy to do if you just follow his example on the site On Oct 26, 3:00 pm, ChaosAD chao...@gmail.com wrote: I'm fairly new to Tablesort, but got it working for the most part. The only problem I have is any columns that have a a href/a in them. It seems to sort it based on the url and not that actual data in the cell. How do I get it to sort based on the data and not the url?
[jQuery] Question Urgent
hi, I´m building a jCarousel following the tuturials and the example that you´ve post in http://sorgalla.com. I want to build a Vertical carousel but with to columms (one side by side the other). I know that it can be made using css, but i´m new to css and i can´t do it without our help. Can you help me? Its urgent. Thanks. Pedro Borges Portugal
[jQuery] Beginner - how to travers up one node and down again
I'm trying to do a simple show/hide. When a user clicks an a link, I want to hide the dd for that link. Any ideas why the .children() is not working? !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; html head titleTabs 1/title style type=text/css .hide {display: none;} /style script type=text/javascript src=jquery-1.3.2.min.js/script script type=text/javascript $(document).ready(function(){ $('#tabs dd').addClass('hide'); $('dt a').click(function() { $(this).parent().children().removeClass('hide'); }); }); /script /head body h1Test 1/h1 dl id=tabs dta href=#onetab 1/a/dt dd id=one h2Container 1/h2 pRandom content./p /dd dta href=#twotab 2/a/dt dd id=two h2Container 2/h2 pRandom content./p /dd dta href=#threetab 3/a/dt dd id=three h2Container 3/h2 pRandom content./p /dd /dl /body /html
[jQuery] Re: How to access a JavaScript object from within an ajax call?
He who masters the context shall inherit the JavaScript. ^^v Michel Belleville 2009/10/27 Joe joecel...@gmail.com Thx!!! This is exactly what i was looking for!!! I knew there was a simple solution. Joe C On Oct 27, 11:08 am, Michel Belleville michel.bellevi...@gmail.com wrote: Well, you're using $.ajax() and the context of its callbacks make this the xhr object, so no surprise there. This should work as you expect : var myself = this; var Zone = function(data) { myself.someInfo = data; myself.load = Zone_Load;}; var Zone_Load = function() { $.ajax({ type: GET, url: http://localhost/foo.xml;, success: requestSuccess}); }; var requestSuccess = function(data) { myself.someInfo = $(data).find('type'); }; JavaScript allows methods to access all objects contained by the context they're declared in (provided you don't declare nested variables overriding existing context variables). In this case we declare myself and give it a reference to the content of this so when this is bound to other objects we still can use myself to access the desired object. Michel Belleville 2009/10/27 Joe joecel...@gmail.com I am trying to access my own JS object from within an ajax call, and can't figure out how to get it to work. Whenever I access this in the function, it returns the ajax context and not my JS object context. My code looks something like this. I have a Zone object defined in a JS file like this: //START CODE function Zone(data){ this.someInfo = data; this.load = Zone_Load; } function Zone_Load(){ $.ajax({ type: GET, url: http://localhost/foo.xml;, success: requestSuccess }); } function requestSuccess(data){ this.someInfo = $(data).find('type'); } //ENDCODE I am having problems with the last line. How do i get access to the JS object, so that i can set some info on it, based on the ajax call? Any help would be appreciated? thx, Joe C
[jQuery] Re: Sort columns with URL in Tablesort
Not entirely sure what you mean by removed all the white space. Could you please elaborate. On Oct 27, 11:39 am, Jacob jste...@gmail.com wrote: I recently had the same problem of links sorting by the URL, but I discovered that if I removed all the white space within the cell in my HTML it would sort by the text and not the URL. I don't know if that will help you with em tags as well, but it solved the problem for links for me. On Oct 27, 7:53 am, ChaosAD chao...@gmail.com wrote: Here is example of table presently working on. I using the code below, but getting error message: $(document).ready(function() { // call the tablesorter plugin $(table).tablesorter({ // define a custom text extraction function textExtraction: function(node) { // extract data from markup and return it return node.childNodes[0].childNodes[0].innerHTML; } }); }); Error: node.childNodes[0].childNodes[0] is undefined Example row: td54/tdtd34/tdtda hred='something' target='_blank'blah/ a/td On Oct 26, 6:55 pm, ChaosAD chao...@gmail.com wrote: Thanks, I will tomorrow when back at work. Right now it is data in td themselves and links inside as well. I want to make it flexable though so it can handle other types such as em etc. On Oct 26, 6:26 pm, MorningZ morni...@gmail.com wrote: Perhaps post an example of the table's HTML and it would (much) easier to help as your first post mentioned a tags and you implied it was nothing but those, now you have em or no tag at all, quite a bit more complicated now On Oct 26, 4:45 pm, ChaosAD chao...@gmail.com wrote: Thanks for the reply. My problem is rising from the fact that not all column are url based. Some are straight data and some others might have other tags such as em around them. I tried following the example for custom parser and I kept getting s integer errors. Sorry if this is simple problem, I am very nice to jquery and especially tablesort. On Oct 26, 4:36 pm, MorningZ morni...@gmail.com wrote: You'll need to write a custom Parser so that you get what's inside the a tag and not the string itself... It's very easy to do if you just follow his example on the site On Oct 26, 3:00 pm, ChaosAD chao...@gmail.com wrote: I'm fairly new to Tablesort, but got it working for the most part. The only problem I have is any columns that have a a href/a in them. It seems to sort it based on the url and not that actual data in the cell. How do I get it to sort based on the data and not the url?
[jQuery] Re: Beginner - how to travers up one node and down again
dta href=#onetab 1/a/dt dd id=one h2Container 1/h2 pRandom content./p /dd $('dt a') who's your daddy ? it's dt of course, because I'm a. So daddy, who are your children ? Well I see only a. Well, where's the dd ? It's dt's sibling of course : dt.../dt dd.../dd Yeah, apparently there's no dd in your dt. So : $(this).closest('dt').next('dd').removeClass('hide'); Should do the trick, though you might prefer using toggleClass() . Michel Belleville 2009/10/27 Martin martin.m.ri...@gmail.com I'm trying to do a simple show/hide. When a user clicks an a link, I want to hide the dd for that link. Any ideas why the .children() is not working? !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; html head titleTabs 1/title style type=text/css .hide {display: none;} /style script type=text/javascript src=jquery-1.3.2.min.js/script script type=text/javascript $(document).ready(function(){ $('#tabs dd').addClass('hide'); $('dt a').click(function() { $(this).parent().children().removeClass('hide'); }); }); /script /head body h1Test 1/h1 dl id=tabs dta href=#onetab 1/a/dt dd id=one h2Container 1/h2 pRandom content./p /dd dta href=#twotab 2/a/dt dd id=two h2Container 2/h2 pRandom content./p /dd dta href=#threetab 3/a/dt dd id=three h2Container 3/h2 pRandom content./p /dd /dl /body /html
[jQuery] Basic help with selectors
Hello, I'm new to jQuery and would appreciate some help with Selectors. At the moment I know enough to write some clunky repetitive code that violates the DRY (Don't Repeat Yourself) principle // Toggle Divs $(a#toggle_effect_button).click(function(){ $(#toggle_effect).toggle('blind',500); return false; }); $(a#toggle_effect_button2).click(function(){ $(#toggle_effect2).toggle('blind',500); return false; }); $(a#toggle_effect_button3).click(function(){ $(#toggle_effect3).toggle('blind',500); return false; }); $(a#toggle_effect_button4).click(function(){ $(#toggle_effect4).toggle('blind',500); return false; }); $(a#toggle_effect_button5).click(function(){ $(#toggle_effect5).toggle('blind',500); return false; }); $(a#toggle_effect_button6).click(function(){ $(#toggle_effect6).toggle('blind',500); return false; }); $(a#toggle_effect_button7).click(function(){ $(#toggle_effect7).toggle('blind',500); return false; }); $(a#toggle_effect_button8).click(function(){ $(#toggle_effect8).toggle('blind',500); return false; }); How can I boilerplate code like this? They all refer to similar links that controller the jQueryUI toggle action on DIV containers. If I assign a class to the toggle_effect_button hyperlinks is there a way to locate the correct DIV and toggle it? Or am I already doing this in the most concise way? Thanks for your help ~sm
[jQuery] Re: Sort columns with URL in Tablesort
where is the em at? like here is what you need to post table thead trHeader Row/tr /thead tbody 5 or so rows of various data /tbody /table don't worry about posting your parser code, as obviously it has issues and if you want to keep the HTML intact without Google Groups messing with it, post the HTML on a site like http://jsbin.com or the like On Oct 27, 11:58 am, ChaosAD chao...@gmail.com wrote: Not entirely sure what you mean by removed all the white space. Could you please elaborate. On Oct 27, 11:39 am, Jacob jste...@gmail.com wrote: I recently had the same problem of links sorting by the URL, but I discovered that if I removed all the white space within the cell in my HTML it would sort by the text and not the URL. I don't know if that will help you with em tags as well, but it solved the problem for links for me. On Oct 27, 7:53 am, ChaosAD chao...@gmail.com wrote: Here is example of table presently working on. I using the code below, but getting error message: $(document).ready(function() { // call the tablesorter plugin $(table).tablesorter({ // define a custom text extraction function textExtraction: function(node) { // extract data from markup and return it return node.childNodes[0].childNodes[0].innerHTML; } }); }); Error: node.childNodes[0].childNodes[0] is undefined Example row: td54/tdtd34/tdtda hred='something' target='_blank'blah/ a/td On Oct 26, 6:55 pm, ChaosAD chao...@gmail.com wrote: Thanks, I will tomorrow when back at work. Right now it is data in td themselves and links inside as well. I want to make it flexable though so it can handle other types such as em etc. On Oct 26, 6:26 pm, MorningZ morni...@gmail.com wrote: Perhaps post an example of the table's HTML and it would (much) easier to help as your first post mentioned a tags and you implied it was nothing but those, now you have em or no tag at all, quite a bit more complicated now On Oct 26, 4:45 pm, ChaosAD chao...@gmail.com wrote: Thanks for the reply. My problem is rising from the fact that not all column are url based. Some are straight data and some others might have other tags such as em around them. I tried following the example for custom parser and I kept getting s integer errors. Sorry if this is simple problem, I am very nice to jquery and especially tablesort. On Oct 26, 4:36 pm, MorningZ morni...@gmail.com wrote: You'll need to write a custom Parser so that you get what's inside the a tag and not the string itself... It's very easy to do if you just follow his example on the site On Oct 26, 3:00 pm, ChaosAD chao...@gmail.com wrote: I'm fairly new to Tablesort, but got it working for the most part. The only problem I have is any columns that have a a href/a in them. It seems to sort it based on the url and not that actual data in the cell. How do I get it to sort based on the data and not the url?
[jQuery] Re: Basic help with selectors
$(a[id=^='toggle_effect_button']).click(function() { var id = this.id.replace(toggle_effect_button, ); $(#toggle_effect + id).toggle('blind',500); return false; }); On Oct 27, 12:06 pm, Simon Morris moz...@gmail.com wrote: Hello, I'm new to jQuery and would appreciate some help with Selectors. At the moment I know enough to write some clunky repetitive code that violates the DRY (Don't Repeat Yourself) principle // Toggle Divs $(a#toggle_effect_button).click(function(){ $(#toggle_effect).toggle('blind',500); return false; }); $(a#toggle_effect_button2).click(function(){ $(#toggle_effect2).toggle('blind',500); return false; }); $(a#toggle_effect_button3).click(function(){ $(#toggle_effect3).toggle('blind',500); return false; }); $(a#toggle_effect_button4).click(function(){ $(#toggle_effect4).toggle('blind',500); return false; }); $(a#toggle_effect_button5).click(function(){ $(#toggle_effect5).toggle('blind',500); return false; }); $(a#toggle_effect_button6).click(function(){ $(#toggle_effect6).toggle('blind',500); return false; }); $(a#toggle_effect_button7).click(function(){ $(#toggle_effect7).toggle('blind',500); return false; }); $(a#toggle_effect_button8).click(function(){ $(#toggle_effect8).toggle('blind',500); return false; }); How can I boilerplate code like this? They all refer to similar links that controller the jQueryUI toggle action on DIV containers. If I assign a class to the toggle_effect_button hyperlinks is there a way to locate the correct DIV and toggle it? Or am I already doing this in the most concise way? Thanks for your help ~sm
[jQuery] Re: Basic help with selectors
How about using a class instead of ID's? $('a.toggle_effect_button').click(function() { $(this).toggle('blind',500); return false; }); -Original Message- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of MorningZ Sent: Tuesday, October 27, 2009 12:11 PM To: jQuery (English) Subject: [jQuery] Re: Basic help with selectors $(a[id=^='toggle_effect_button']).click(function() { var id = this.id.replace(toggle_effect_button, ); $(#toggle_effect + id).toggle('blind',500); return false; }); On Oct 27, 12:06 pm, Simon Morris moz...@gmail.com wrote: Hello, I'm new to jQuery and would appreciate some help with Selectors. At the moment I know enough to write some clunky repetitive code that violates the DRY (Don't Repeat Yourself) principle // Toggle Divs $(a#toggle_effect_button).click(function(){ $(#toggle_effect).toggle('blind',500); return false; }); $(a#toggle_effect_button2).click(function(){ $(#toggle_effect2).toggle('blind',500); return false; }); $(a#toggle_effect_button3).click(function(){ $(#toggle_effect3).toggle('blind',500); return false; }); $(a#toggle_effect_button4).click(function(){ $(#toggle_effect4).toggle('blind',500); return false; }); $(a#toggle_effect_button5).click(function(){ $(#toggle_effect5).toggle('blind',500); return false; }); $(a#toggle_effect_button6).click(function(){ $(#toggle_effect6).toggle('blind',500); return false; }); $(a#toggle_effect_button7).click(function(){ $(#toggle_effect7).toggle('blind',500); return false; }); $(a#toggle_effect_button8).click(function(){ $(#toggle_effect8).toggle('blind',500); return false; }); How can I boilerplate code like this? They all refer to similar links that controller the jQueryUI toggle action on DIV containers. If I assign a class to the toggle_effect_button hyperlinks is there a way to locate the correct DIV and toggle it? Or am I already doing this in the most concise way? Thanks for your help ~sm
[jQuery] Re: Basic help with selectors
Indeed it seems very repetitive as much as clunky. Though without a glimpse of html I guess I can't do much for you, especially since your code currently uses ids to locate things which doesn't help one bit understanding the underlying dom structure... So, let's assume your html looks something like : div id=toggle_effect ... a id=toggle_effect_button.../a ... /div ... div id=toggle_effect_2 ... a id=toggle_effect_button_2.../a ... /div ... I'd change this to : div class=toggle_effect ... a class=toggle_effect_button.../a ... /div ... div class=toggle_effect ... a class=toggle_effect_button.../a ... /div ... Then you just need to write : $('.toggle_effect .toggle_effect_button').live('click', function() { $(this).closest('.toggle_effect').toggle('blind', 500); return false; }); Using classes is a world less messy than repeating ids with a small change. Navigating through the DOM is much quicker than using ids. Using live will bind your actions to any new element added to your document (through AJAX for example). Michel Belleville 2009/10/27 Simon Morris moz...@gmail.com Hello, I'm new to jQuery and would appreciate some help with Selectors. At the moment I know enough to write some clunky repetitive code that violates the DRY (Don't Repeat Yourself) principle // Toggle Divs $(a#toggle_effect_button).click(function(){ $(#toggle_effect).toggle('blind',500); return false; }); $(a#toggle_effect_button2).click(function(){ $(#toggle_effect2).toggle('blind',500); return false; }); $(a#toggle_effect_button3).click(function(){ $(#toggle_effect3).toggle('blind',500); return false; }); $(a#toggle_effect_button4).click(function(){ $(#toggle_effect4).toggle('blind',500); return false; }); $(a#toggle_effect_button5).click(function(){ $(#toggle_effect5).toggle('blind',500); return false; }); $(a#toggle_effect_button6).click(function(){ $(#toggle_effect6).toggle('blind',500); return false; }); $(a#toggle_effect_button7).click(function(){ $(#toggle_effect7).toggle('blind',500); return false; }); $(a#toggle_effect_button8).click(function(){ $(#toggle_effect8).toggle('blind',500); return false; }); How can I boilerplate code like this? They all refer to similar links that controller the jQueryUI toggle action on DIV containers. If I assign a class to the toggle_effect_button hyperlinks is there a way to locate the correct DIV and toggle it? Or am I already doing this in the most concise way? Thanks for your help ~sm
[jQuery] Re: Beginner - how to travers up one node and down again
Hi, If you just want to do a simple show/hide then you don't need to add a class. You can use jQuery hide() and toggle() functions. Like this: $('#tabs dd').hide(); $('#tabs dt a').click(function() { $(this).parent().next().toggle(); return false; }); Paul On Oct 27, 3:59 pm, Michel Belleville michel.bellevi...@gmail.com wrote: dta href=#onetab 1/a/dt dd id=one h2Container 1/h2 pRandom content./p /dd $('dt a') who's your daddy ? it's dt of course, because I'm a. So daddy, who are your children ? Well I see only a. Well, where's the dd ? It's dt's sibling of course : dt.../dt dd.../dd Yeah, apparently there's no dd in your dt. So : $(this).closest('dt').next('dd').removeClass('hide'); Should do the trick, though you might prefer using toggleClass() . Michel Belleville 2009/10/27 Martin martin.m.ri...@gmail.com I'm trying to do a simple show/hide. When a user clicks an a link, I want to hide the dd for that link. Any ideas why the .children() is not working? !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; html head titleTabs 1/title style type=text/css .hide {display: none;} /style script type=text/javascript src=jquery-1.3.2.min.js/script script type=text/javascript $(document).ready(function(){ $('#tabs dd').addClass('hide'); $('dt a').click(function() { $(this).parent().children().removeClass('hide'); }); }); /script /head body h1Test 1/h1 dl id=tabs dta href=#onetab 1/a/dt dd id=one h2Container 1/h2 pRandom content./p /dd dta href=#twotab 2/a/dt dd id=two h2Container 2/h2 pRandom content./p /dd dta href=#threetab 3/a/dt dd id=three h2Container 3/h2 pRandom content./p /dd /dl /body /html
[jQuery] Re: Basic help with selectors
On Oct 27, 12:16 pm, Rick Faircloth r...@whitestonemedia.com wrote: How about using a class instead of ID's? $('a.toggle_effect_button').click(function() { $(this).toggle('blind',500); return false; }); That would hide the a itself (which is not what his repetitive code does)
[jQuery] Re: namespacing jQuery
Sorry - should have mentioned - I tried using jQuery.noConflict() as well as jQuery.noConflict(true) and reassigning to a variable, but ran into race conditions where another version of jQuery was executing a call before I could call noConflict()... I'm hoping to namespace my own separate version of jQuery sitting in another file such that I only have to do one script src call and end up with a myjQuery instead of jQuery. Thanks again for your help! On Oct 27, 11:08 am, Dan G. Switzer, II dswit...@pengoworks.com wrote: See the $.noConflict() docs:http://docs.jquery.com/Core/jQuery.noConflict var j = *jQuery.noConflict*(); // Do something with jQuery j(div p).hide http://docs.jquery.com/Effects/hide(); // Do something with another library's $() $(content).style.display = 'none'; -Dan On Tue, Oct 27, 2009 at 10:25 AM, El Greg greglaval...@gmail.com wrote: I'm interested in namespacing jQuery to something like $myjQ. or myjQ. $ and wondering what the best way is to do it. I will potentially be using my version of jQuery on other pages that are running other versions of jQuery - hence the idea to rename it completely so that I have control over version, plugins, etc. I thought about just doing a find and replace on the word jQuery in the source, but I'm hoping there's an easier way. Thanks!
[jQuery] Structuring advice: cloning a set of dynamic dropdown menus
Hi there, I have a table that looks like this: The user can click the 'Add another category' link and another row is inserted. My issue is here: those two select boxes are linked, meaning that depending on what is chosen from the first one, the options are changed in the second one. When I clone this row, the new cloned row doesn't work properly - the first select box ('Publication') changes ALL of the 'Categories' choices in the second column. My HTML is structured so that the table row contains each of the possible select elements, each given an ID that corresponds to an ID number in the Publication select. For example, the Publication dropdown HTML is: select name=publicationID id=publicationID option value=01 onClick=showSubMenu('0'); Publication / option option value=21 onClick=showSubMenu('21'); Student /option option value=40 onClick=showSubMenu('40'); Contract /option option value=99 onClick=showSubMenu('99'); All Publications / option /select As a result, I have 4 hidden select boxes corresponding to each of these Publication choices. Make sense? I feel like there must be a better way to organise this - can anyone advise me on how to do it? Above all, I can't seem to target the newly- cloned select boxes without grabbing them all. Thanks, Matt
[jQuery] Re: Structuring advice: cloning a set of dynamic dropdown menus
Oops, missed the link: http://imgur.com/p25xN.jpg On Oct 27, 4:45 pm, Matt guitarroman...@gmail.com wrote: Hi there, I have a table that looks like this: The user can click the 'Add another category' link and another row is inserted. My issue is here: those two select boxes are linked, meaning that depending on what is chosen from the first one, the options are changed in the second one. When I clone this row, the new cloned row doesn't work properly - the first select box ('Publication') changes ALL of the 'Categories' choices in the second column. My HTML is structured so that the table row contains each of the possible select elements, each given an ID that corresponds to an ID number in the Publication select. For example, the Publication dropdown HTML is: select name=publicationID id=publicationID option value=01 onClick=showSubMenu('0'); Publication / option option value=21 onClick=showSubMenu('21'); Student /option option value=40 onClick=showSubMenu('40'); Contract /option option value=99 onClick=showSubMenu('99'); All Publications / option /select As a result, I have 4 hidden select boxes corresponding to each of these Publication choices. Make sense? I feel like there must be a better way to organise this - can anyone advise me on how to do it? Above all, I can't seem to target the newly- cloned select boxes without grabbing them all. Thanks, Matt
[jQuery] Delfate (and zlib) encoding is better than gzip.
jQuery.com's homepage encourages using a gzipped version of jQuery. Why not advertise HTTP 1.1 deflate encoding instead? It is better. (even better than HTTP 1.1 deflate is sending raw deflate [without the zlib wrapper]). I've done some research on this and posted the results here: http://stackoverflow.com/questions/1574168/gzip-vs-deflate-zlib-revisited Are there any reasons to _not_ encourage deflate over gzip?
[jQuery] auto-complete
anyone have any examples of auto-complete ?? tenks
[jQuery] Firing existing events from jQuery inserted html
I have a problem with jQuery appending new text to a div - but then not firing events attached to the inserted text. Let me explain. I have a div that contains a number of divs - the div has a link and a hidden form. Clicking on the link fires a slideToggle event which reveals the form. When you submit the form AJAX handles it - and jQuery builds another div with the correct link and the correct form which it sticks on the end of the list. That all works fine and dandy. What I want to be able to do is to click on the newly-added link and have it behave in the same way as the other elements that were on the page when it was built. However, nothing happens when you click on it. Zip. Nadda. Rien du tout. Usually I have found a way round the problem - but I am slightly stuck on my current project. Apart from forcing a page reload, is there any way to get the browser to see the newly inserted link and apply the jQuery action to it? Thanks
[jQuery] submit of only the result from a quicksearch
I would like only to submit the result of a Jquery quicksearch which i have put on a html table. If i do a normal submit , I get every row submitted , also those where jquery puts display ; none An even better is it also possible to use ajax to submit when a row is changed . my TR 's has about 5 TD pr TR and max 500 TR' s thanks in advance
[jQuery] how to remove elements by attribute
Hi, How can I remove all div foo=whatver... div elements using the attribute foo for my selector? Basically any div with a foo attribute I want gone. Thanks, Jason
[jQuery] Submitting after Validation
I'm trying to create a contact form using Jquery Validation and Ajax Submit. I'm having a problem figuring out the best way to submit the results to a php file. Below is a break down of my validation code. $().ready(function(){ $(#signupForm).validate({ rules: { fullname: required, company: required, phone: required, email: { required: true, email: true } }, messages: { fullname: Please enter your fullname, company: Please enter a company name, phone: Please enter a phone number, email: Please enter a valid email address } }); });
[jQuery] Re: how to remove elements by attribute
$('div[foo]').remove(); On Tue, Oct 27, 2009 at 1:04 PM, jason jason.novo...@gmail.com wrote: Hi, How can I remove all div foo=whatver... div elements using the attribute foo for my selector? Basically any div with a foo attribute I want gone. Thanks, Jason
[jQuery] Re: Firing existing events from jQuery inserted html
You have run into a fairly common issue: how to get events to work with elements that are added to the DOM, through either ajax or simple DOM mainpulation. Rather than using the .click(fn) shorthand, use .live('click', fn) For more information, check out this FAQ topic: http://docs.jquery.com/Frequently_Asked_Questions#Why_do_my_events_stop_working_after_an_Ajax_request.3F If you still have problems after reading through it and trying one of the many solutions, let us know. --Karl Karl Swedberg www.englishrules.com www.learningjquery.com On Oct 27, 2009, at 12:01 PM, BenR wrote: I have a problem with jQuery appending new text to a div - but then not firing events attached to the inserted text. Let me explain. I have a div that contains a number of divs - the div has a link and a hidden form. Clicking on the link fires a slideToggle event which reveals the form. When you submit the form AJAX handles it - and jQuery builds another div with the correct link and the correct form which it sticks on the end of the list. That all works fine and dandy. What I want to be able to do is to click on the newly-added link and have it behave in the same way as the other elements that were on the page when it was built. However, nothing happens when you click on it. Zip. Nadda. Rien du tout. Usually I have found a way round the problem - but I am slightly stuck on my current project. Apart from forcing a page reload, is there any way to get the browser to see the newly inserted link and apply the jQuery action to it? Thanks
[jQuery] Re: how to remove elements by attribute
On Oct 27, 2009, at 1:04 PM, jason wrote: Hi, How can I remove all div foo=whatver... div elements using the attribute foo for my selector? Basically any div with a foo attribute I want gone. Thanks, Jason You could try this: $('div[foo]').remove(); --Karl Karl Swedberg www.englishrules.com www.learningjquery.com
[jQuery] Re: Basic help with selectors
On Tue, 2009-10-27 at 09:11 -0700, MorningZ wrote: $(a[id=^='toggle_effect_button']).click(function() { var id = this.id.replace(toggle_effect_button, ); $(#toggle_effect + id).toggle('blind',500); return false; }); Thanks MorningZ, A small correction is.. $(a[id^='toggle_effect_button']).click(function() { It works perfectly. I appreciate all the replies ~sm
[jQuery] Re: Submitting after Validation
Look the submitHandler option: http://docs.jquery.com/Plugins/Validation/validate#toptions On Tue, Oct 27, 2009 at 15:02, StephenJacob turnstylecreat...@gmail.comwrote: I'm trying to create a contact form using Jquery Validation and Ajax Submit. I'm having a problem figuring out the best way to submit the results to a php file. Below is a break down of my validation code. $().ready(function(){ $(#signupForm).validate({ rules: { fullname: required, company: required, phone: required, email: { required: true, email: true } }, messages: { fullname: Please enter your fullname, company: Please enter a company name, phone: Please enter a phone number, email: Please enter a valid email address } }); });
[jQuery] Re: Basic help with selectors
Gotcha... -Original Message- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of MorningZ Sent: Tuesday, October 27, 2009 12:31 PM To: jQuery (English) Subject: [jQuery] Re: Basic help with selectors On Oct 27, 12:16 pm, Rick Faircloth r...@whitestonemedia.com wrote: How about using a class instead of ID's? $('a.toggle_effect_button').click(function() { $(this).toggle('blind',500); return false; }); That would hide the a itself (which is not what his repetitive code does)
[jQuery] Re: Nested :eq selector issue?
This is the entire html. I would expect it would return the HTML tag as it does with :first, but it errors on the second alert when using :eq(0) html head script language=javascript src=jquery-1.3.2.js/script script $().ready(function() { alert($(*:has(BODY *:first)).eq(0)[0].tagName); alert($(*:has(BODY *:eq(0))).eq(0)[0].tagName); }); /script /head body div / /body /html
[jQuery] Re: Problem with fade-effects and IE8
I am using v 1.3.2. I suspect that the issue is related to poor javascript coding on my part. Delayed response, I know, but I just discovered that I had a reply... On Oct 1, 8:03 am, Jon Banner banali...@googlemail.com wrote: What version of jQuery are you using? I have not had problems with IE8 using version 1.3.2, and i've just checked some sites that i've previously worked on using 1.2.6, and they don't seem to have any problems with fade in or fade out. Maybe you have a beta version of IE8? Jon 2009/9/30 dirknibleck paul.ship...@clickonce.ca I am experiencing the same issue with slideToggle and toggle in Internet Explorer 8. Were you able to find a resolution? On Sep 8, 2:08 am, Boolace bool...@googlemail.com wrote: Hi, I've a problem with the fadeIn() and fadeOut()-commands of jQuery usingInternetExplorer8. Firefox, Opera, Safari and IE up to version 7 works fine. I'm not getting an error or something from the console, the effect is simply not executed. The elemtent is staying fixed and doesn't hide and vice verca. Any Idea if this is caused in jQuery? Anybody else who has this problems? Thanks and greetings, Boolace
[jQuery] adding class whenwindow is resized below 1000px
Hi everyone, I'm trying to figure out a way to add a class only if the browser is resized by the user at less then 1000px This is what i have going right now. $(function(){ $(window).width('width','100%'); $('body').css('width','w 1000px'); $(body).addClass(no_border); }); as of now the class of no_border is added to the bofy at any width, like I mentionned above i only need thsi class to be applied if the user or if the window is at less then 1000px Thanks for taking the time
[jQuery] Re: Nested :eq selector issue?
I just tested against 1.2.6 and it works. Would this now be considered a bug in Sizzle?
[jQuery] Re: namespacing jQuery
If your script tag that loads jQuery is immediately followed by another script tag that calls noConflict, there should be no race conditions. You're not putting the noConflict call inside a $(document).ready() or the like, are you? It should be directly executed in a script tag: script type=text/javascript src=my.jquery.js/script script type=text/javascript var jq = jQuery.noConflict(); /script -Mike On Tue, Oct 27, 2009 at 9:42 AM, El Greg greglaval...@gmail.com wrote: Sorry - should have mentioned - I tried using jQuery.noConflict() as well as jQuery.noConflict(true) and reassigning to a variable, but ran into race conditions where another version of jQuery was executing a call before I could call noConflict()... I'm hoping to namespace my own separate version of jQuery sitting in another file such that I only have to do one script src call and end up with a myjQuery instead of jQuery. Thanks again for your help! On Oct 27, 11:08 am, Dan G. Switzer, II dswit...@pengoworks.com wrote: See the $.noConflict() docs: http://docs.jquery.com/Core/jQuery.noConflict var j = *jQuery.noConflict*(); // Do something with jQuery j(div p).hide http://docs.jquery.com/Effects/hide(); // Do something with another library's $() $(content).style.display = 'none'; -Dan On Tue, Oct 27, 2009 at 10:25 AM, El Greg greglaval...@gmail.com wrote: I'm interested in namespacing jQuery to something like $myjQ. or myjQ. $ and wondering what the best way is to do it. I will potentially be using my version of jQuery on other pages that are running other versions of jQuery - hence the idea to rename it completely so that I have control over version, plugins, etc. I thought about just doing a find and replace on the word jQuery in the source, but I'm hoping there's an easier way. Thanks!
[jQuery] How to display image from urls
Hi all, In my application, i get a set of urls. the url basically contains an image. How do i dynamically extract the image from that url and display on my page. Thanks Arun
[jQuery] Re: Submitting after Validation
Leonardo, I've been looking into the submitHandler option but i'm having problems getting it to work correctly. Here is a sample of the code i'm testing. $(#signupForm).validate({ rules: { fullname: required, company: required, phone: required, email: { required: true, email: true } }, messages: { fullname: Please enter your fullname, company: Please enter a company name, phone: Please enter a phone number, email: Please enter a valid email address }, submitHandler: function() { form.submit(); } }); form class=cmxform id=signupForm method=POST action=process.php div class=formline label for=fullname* Name:/label input type=text id=fullname name=fullname class=textbox / /div div class=formline label for=company* Company:/label input type=text name=company id=company class=textbox / /div div class=formline label for=email* Email:/label input type=text name=email id=email class=textbox / /div div class=formline label for=phone* Phone:/label input type=text name=phone id=phone class=textbox / /div div class=formline label for=messageMessage:/label textarea name=message id=message class=messagebox/ textarea /div div class=formline label for=button/label input type=submit value=Submit alt=Send Message / input type=hidden name=subcontact value=1 / /div /form On Oct 27, 1:42 pm, Leonardo K leo...@gmail.com wrote: Look the submitHandler option: http://docs.jquery.com/Plugins/Validation/validate#toptions On Tue, Oct 27, 2009 at 15:02, StephenJacob turnstylecreat...@gmail.comwrote: I'm trying to create a contact form using Jquery Validation and Ajax Submit. I'm having a problem figuring out the best way to submit the results to a php file. Below is a break down of my validation code. $().ready(function(){ $(#signupForm).validate({ rules: { fullname: required, company: required, phone: required, email: { required: true, email: true } }, messages: { fullname: Please enter your fullname, company: Please enter a company name, phone: Please enter a phone number, email: Please enter a valid email address } }); });
[jQuery] Re: Superfish plugin: some limitations that could be addressed
Thanks for this example. there's no doubt in my mind that YUI team hasn't processed all the issues you bring up when making their determinations on structure I don't know if they have. The YUI developers are very capable people, but this does not totally guarantee that YUI is accessible or that they don't get things wrong sometimes. But i can see that they're doing exactly what i'm saying that Superfish should allow. What YUI 3.0 Menu has: ... li a class=yui-menu-labelSubmenu title (e.g. category name)/a div class=yui-menu div class=yui-menu-content ul li class=yui-menuitem.../li li class=yui-menuitem.../li /ul /div /div /li ... This is perfectly fine. There are two containing DIVs, which has no semantic and accessibility impact (DIVs are neutral). Then the content of the submenu, which in this case is a UL list with one LI for each submenu item. Nothing wrong here. This is exactly the structure i had to code, and why i had to hack Superfish which doesn't allow it. ;) So what i had to code would fit perfectly with this YUI widget: ... li a class=yui-menu-labelCategory name/a div class=yui-menu div class=yui-menu-content pShort description of the category's content/p ul li class=yui-menuitem.../li li class=yui-menuitem.../li /ul /div /div /li ... Meanwhile, what you said was fine (and i believe is not, though it's not a BIG issue) is, using similar classes: ... li a class=menu-labelCategory name/a ul class=menu li class=menu-content pShort description of the category's content/p ul li class=menuitem.../li li class=menuitem.../li /ul /li /ul /li ... (Or maybe with a DIV between the container LI and the submenu's content, to avoid problems with current Superfish inner selectors.) Regarding higher powers, i should consult with accessibility experts i know about using a one-item unordered list as a container (just because Superfish requires it...). It's not elegant, and i suspect it might cause problems to some screen-reader users, but they may be able to confirm how significant those problems would be. Anyway, being forced to use subpar HTML code because a JS script requires some particular tags is never a good thing. In this case the consequences may be benign (or not...), in other cases they may be quite bad.
[jQuery] Re: $.post(), php file in parent directory?
Yes. // parent directory $.post('../file.php'); // folder in parent directory $.post('../dir/file.php'); // folder in grandparent directory $.post('../../folder/file.php'); // child directory $.post('child/file.php'); $.post('./child/file.php'); // base directory $.post('/file.php'); // current directory $.post('file.php'); $.post('./file.php'); On Oct 26, 11:29 am, Vlad jouk.v...@gmail.com wrote: Is it possible to use $.post() with the php file in parent directory or a completely different directory?
[jQuery] Re: Using a \n (new line) as the multipleSeparator in Internet Explorer does not work
Did you ever find a solution to this? I'm having the same problem. On Oct 22, 3:14 pm, Gabe g...@kokiri.org wrote: I've been getting some buggy behavior with IE7 when using a new line character as the multipleSeparator. Here is my sample code: textarea name=search[movies] rows=4 cols=20 id=search_movies/textarea $('#search_movies').autocomplete( 'ajax_movie_autocomplete', { mustMatch: true, multiple: true, multipleSeparator: \n }); Firefox and Safari work great. In IE, the first entry works fine, but the cursor stays on the same line. When you hit a character for your second entry, the cursor drops down a line and starts displaying the auto-complete options for your new text appropriately. However, if you hit enter, it fails to autocomplete at all and just drops down to a new line. If you instead select the option with your mouse instead of hitting enter, it changes the first line instead of the line you're actually on. I receive the same behavior if I set multipleSeparator: \r\n . Also, \r\n is completely broken Firefox and Safari. The first entry works fine, but the second entry completely wipes out everything typed into the textarea so far. If anyone has a solution for IE, I'd love it worked on the \n form, as I'd rather not browser sniff to determine the separator.
[jQuery] Re: Beginner - how to travers up one node and down again
Thanks guys, Nice to get such a quick reply. Thanks for the tips! Martin On Oct 27, 4:29 pm, Paul Mills paul.f.mi...@gmail.com wrote: Hi, If you just want to do a simple show/hide then you don't need to add a class. You can use jQuery hide() and toggle() functions. Like this: $('#tabs dd').hide(); $('#tabs dt a').click(function() { $(this).parent().next().toggle(); return false; }); Paul On Oct 27, 3:59 pm, Michel Belleville michel.bellevi...@gmail.com wrote: dta href=#onetab 1/a/dt dd id=one h2Container 1/h2 pRandom content./p /dd $('dt a') who's your daddy ? it's dt of course, because I'm a. So daddy, who are your children ? Well I see only a. Well, where's the dd ? It's dt's sibling of course : dt.../dt dd.../dd Yeah, apparently there's no dd in your dt. So : $(this).closest('dt').next('dd').removeClass('hide'); Should do the trick, though you might prefer using toggleClass() . Michel Belleville 2009/10/27Martinmartin.m.ri...@gmail.com I'm trying to do a simple show/hide. When a user clicks an a link, I want to hide the dd for that link. Any ideas why the .children() is not working? !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; html head titleTabs 1/title style type=text/css .hide {display: none;} /style script type=text/javascript src=jquery-1.3.2.min.js/script script type=text/javascript $(document).ready(function(){ $('#tabs dd').addClass('hide'); $('dt a').click(function() { $(this).parent().children().removeClass('hide'); }); }); /script /head body h1Test 1/h1 dl id=tabs dta href=#onetab 1/a/dt dd id=one h2Container 1/h2 pRandom content./p /dd dta href=#twotab 2/a/dt dd id=two h2Container 2/h2 pRandom content./p /dd dta href=#threetab 3/a/dt dd id=three h2Container 3/h2 pRandom content./p /dd /dl /body /html
[jQuery] (validate) validator is undefined error
I'm trying to implement Validate on a survey form that has just a few basic requirements. I'm running jQuery 1.3.2 and Validate 1.5.5. Whenever I try to run the code, however, I get an error that validator is undefined. I tried Googling and found only a few hits, most saying the HTML was invalid. Checked that, corrected a few minor errors, but still getting the error. In addition to the code below, I tried just the basic $(#surveyForm).validate() but it still gives the same error. This is on a development application, so it isn't available online yet. Summer SNIPPET FROM JS FILE var validator = $(#surveyForm).validate({ rules: { recommend: required, howlearnedother: { required: function(element) { return $('#howlearned input[name=howlearned]:checked').val() == 0; } }, describeyouother: { required: function(element) { return $('#describeyouother input [name=describeyouother]:checked').val() == 0; } } }, messages: { recommend: Please indicate if you would recommend the SRAC site to others, howlearnedother: Please indicate how you learned about SRAC's publications., describeyouother: Please indicate your industry. } }); ~~~SNIPPET OF HTML FORM form action=?event=submitSurvey method=post fieldset id=surveyForm legendPlease complete this survey to help us improve our offerings:/legend label for=recommendWhat is the likelihood that you would recommend the SRAC web site or its publications to your family and friends? Choose one number below with 1 = not likely and 10 = highly likely./label div id=recommend input name=recommend type=radio value=1 / 1 input name=recommend type=radio value=2 / 2 input name=recommend type=radio value=3 / 3 input name=recommend type=radio value=4 / 4 input name=recommend type=radio value=5 / 5 input name=recommend type=radio value=6 / 6 input name=recommend type=radio value=7 / 7 input name=recommend type=radio value=8 / 8 input name=recommend type=radio value=9 / 9 input name=recommend type=radio value=10 / 10 /div label for=howlearnedHow did you learn about SRAC publications? /label div id=howlearned input name=howlearned type=radio class=checksandradios value=1 / Linked from another web sitebr / input name=howlearned type=radio class=checksandradios value=2 / Search enginebr / input name=howlearned type=radio class=checksandradios value=3 / Professional (e.g. Fisheries/aquaculture biologists)br / input name=howlearned type=radio class=checksandradios value=4 / Extension programbr / input name=howlearned type=radio class=checksandradios value=5 / Friendbr / input name=howlearned type=radio class=checksandradios value=6 / Magazinebr / input name=howlearned type=radio class=checksandradios value=7 / Bookbr / input name=howlearned type=radio class=checksandradios value=0 / Other input id=howlearnedother name=howlearnedother value= type=text size=30 maxlength=30 /br / /div label for=whyvisitWhy did you visit the SRAC web site?/label div id=whyvisit input name=whyvisit type=checkbox class=checksandradios value=1 / Aquaculture producer looking for informationbr / input name=whyvisit type=checkbox class=checksandradios value=2 / Educator looking for information for my classroombr / div id=whyvisiteducator select name=whyvisiteducator
[jQuery] Table row disappears in IE7 (only) when I touch the menu
I have come across a real head-scratcher... Using Superfish 1.4.8 w/SuperSubs to create a horizontal menu with vertical dropdowns. Some of the dropdowns have flyouts). The links on the dropdowns lead to various category pages. Each category page is stored in a database, and uses a table for layout (yeah I know, crappy, but I'm stuck with it at the moment). The table has two rows and three columns. Each cell of the top row contains an image, and each cell of the second row contains descriptive text. On *some* of the pages everything is fine after the page loads until I move the mouse pointer up to the menu. Then the text (in the second row of the table) vanishes. I suspect it's dropping behind the background color on the page, which is rendered in a surrounding DIV. The text only vanishes if I touch the menu, though. To make this even more perplexing, it *only* happens in IE7. FF3, Chrome, Safari, IE8, even IE6 don't display this behavior and not every page even in IE7 (though the same code was copy/pasted to make several pages). The page is rendering in Standards-compliant mode with the correct DOCTYPE and validates. I didn't see anything obvious looking through the superfish.css file to cause this problem. Too much code to post and it's not on a public box :( Ideas? TIA, Laker
[jQuery] [autocomplete] IE7 bugs
I've noticed some strange behavior in IE7 for the bassistance autocomplete plugin. 1. This bug can be seen on the demo page here: Type something into the Multiple Birds (remote) field and select one of the autocomplete choices. Type a couple more letters so the drop down appears again. Hold shift while selecting a second option from the autocomplete drop down and everything below that input box disappears. I've noticed this behavior on my site also. Can someone verify that this is happening for them also? 2. Even though I have the option multiple set to true, it is replacing my first selection every time I select an additional item from the autocomplete drop down. It also will not add a return as a line separator even though I have the option: multipleSeparator: \n You can see the behavior here: http://www.xyggy.com Again these bugs are only in IE7 Any help would be appreciated. Thanks.
[jQuery] Re: Using a \n (new line) as the multipleSeparator in Internet Explorer does not work
Hi Gabe, There seems to be some IE7 bugs with the 1.1 release of the autocomplete plugin. I found that using the 1.1pre version as opposed to 1.1 fixed the problems. There are links to that version here: http://groups.google.com/group/jquery-en/browse_thread/thread/e18783799864e658/d366d7c3a689f4cb?lnk=gstq=autocomplete+IE7#d366d7c3a689f4cb Not sure if there is functionality we are losing by going back to 1.1pre or if this will cause other issues. On Oct 27, 1:49 pm, jmunning jasonmunn...@gmail.com wrote: Did you ever find a solution to this? I'm having the same problem. On Oct 22, 3:14 pm, Gabe g...@kokiri.org wrote: I've been getting some buggy behavior with IE7 when using a new line character as the multipleSeparator. Here is my sample code: textarea name=search[movies] rows=4 cols=20 id=search_movies/textarea $('#search_movies').autocomplete( 'ajax_movie_autocomplete', { mustMatch: true, multiple: true, multipleSeparator: \n }); Firefox and Safari work great. In IE, the first entry works fine, but the cursor stays on the same line. When you hit a character for your second entry, the cursor drops down a line and starts displaying the auto-complete options for your new text appropriately. However, if you hit enter, it fails to autocomplete at all and just drops down to a new line. If you instead select the option with your mouse instead of hitting enter, it changes the first line instead of the line you're actually on. I receive the same behavior if I set multipleSeparator: \r\n . Also, \r\n is completely broken Firefox and Safari. The first entry works fine, but the second entry completely wipes out everything typed into the textarea so far. If anyone has a solution for IE, I'd love it worked on the \n form, as I'd rather not browser sniff to determine the separator.
[jQuery] Selectable and Sortable, with copy and move.
Hi All, Have tried to find an example of this, and played around a bit but got no where. I want to have 2 sortable lists (just like in the demo http://jqueryui.com/demos/sortable/#connect-lists) However I also want to be able to select multiple items and then drag them all from one list to another (and still have them sortable). has anyone got any idea how to do it, it feels a bit like the holy grail as a lot of people are looking for it.
[jQuery] Re: Selectable and Sortable, with copy and move.
Would you mind posting this question to the jquery-ui google group if you haven't done so already? That group is dedicated to questions such as yours that are specifically related to jQuery UI. http://groups.google.com/group/jquery-ui/ Thanks! --Karl Karl Swedberg www.englishrules.com www.learningjquery.com On Oct 27, 2009, at 5:36 PM, Matthew wrote: Hi All, Have tried to find an example of this, and played around a bit but got no where. I want to have 2 sortable lists (just like in the demo http://jqueryui.com/demos/sortable/#connect-lists) However I also want to be able to select multiple items and then drag them all from one list to another (and still have them sortable). has anyone got any idea how to do it, it feels a bit like the holy grail as a lot of people are looking for it.
[jQuery] Re: Superfish plugin: some limitations that could be addressed
superfish shows and hides UL's and doesn't interact with their children like you are saying. The exact same markup in YUI example bellow works perfectly well...no hacks needed Florent V. wrote: Thanks for this example. there's no doubt in my mind that YUI team hasn't processed all the issues you bring up when making their determinations on structure I don't know if they have. The YUI developers are very capable people, but this does not totally guarantee that YUI is accessible or that they don't get things wrong sometimes. But i can see that they're doing exactly what i'm saying that Superfish should allow. What YUI 3.0 Menu has: ... li a class="yui-menu-label"Submenu title (e.g. category name)/a div class="yui-menu" div class="yui-menu-content" ul li class="yui-menuitem".../li li class="yui-menuitem".../li /ul /div /div /li ... This is perfectly fine. There are two containing DIVs, which has no semantic and accessibility impact (DIVs are neutral). Then the content of the submenu, which in this case is a UL list with one LI for each submenu item. Nothing wrong here. This is exactly the structure i had to code, and why i had to hack Superfish which doesn't allow it. ;) So what i had to code would fit perfectly with this YUI widget: ... li a class="yui-menu-label"Category name/a div class="yui-menu" div class="yui-menu-content" pShort description of the category's content/p ul li class="yui-menuitem".../li li class="yui-menuitem".../li /ul /div /div /li ... Meanwhile, what you said was fine (and i believe is not, though it's not a BIG issue) is, using similar classes: ... li a class="menu-label"Category name/a ul class="menu" li class="menu-content" pShort description of the category's content/p ul li class="menuitem".../li li class="menuitem".../li /ul /li /ul /li ... (Or maybe with a DIV between the container LI and the submenu's content, to avoid problems with current Superfish inner selectors.) Regarding higher powers, i should consult with accessibility experts i know about using a one-item unordered list as a container (just because Superfish requires it...). It's not elegant, and i suspect it might cause problems to some screen-reader users, but they may be able to confirm how significant those problems would be. Anyway, being forced to use subpar HTML code because a JS script requires some particular tags is never a good thing. In this case the consequences may be benign (or not...), in other cases they may be quite bad.
[jQuery] Re: Question Urgent
wrap 2 columns in one container and only move the one container...requires some css modifications no matter what you do paparazzy wrote: hi, Im building a jCarousel following the tuturials and the example that youve post in http://sorgalla.com. I want to build a Vertical carousel but with to columms (one side by side the other). I know that it can be made using css, but im new to css and i cant do it without our help. Can you help me? Its urgent. Thanks. Pedro Borges Portugal
[jQuery] Re: Basic help with selectors
if your ID's are only numbered for the sake of trying to match your link to toggle_effect is worth learning about indexing which is extremely useful for 1:1 matching. The allows you to apply class instead of ID to elements assume changing ID's to classes named toggle-effect_button and toggle_effect, code would be very straightforward $(".toggle-effect_button").click(function() { var togIndex=$(".toggle-effect_button").index(this) $("#toggle_effect").eq(togIndex).toggle('blind',500) }); MorningZ wrote: $("a[id=^='toggle_effect_button']").click(function() { var id = this.id.replace("toggle_effect_button", ""); $("#toggle_effect" + id).toggle('blind',500); return false; }); On Oct 27, 12:06pm, Simon Morris moz...@gmail.com wrote: Hello, I'm new to jQuery and would appreciate some help with Selectors. At the moment I know enough to write some clunky repetitive code that violates the DRY (Don't Repeat Yourself) principle // Toggle Divs $("a#toggle_effect_button").click(function(){ $("#toggle_effect").toggle('blind',500); return false; }); $("a#toggle_effect_button2").click(function(){ $("#toggle_effect2").toggle('blind',500); return false; }); $("a#toggle_effect_button3").click(function(){ $("#toggle_effect3").toggle('blind',500); return false; }); $("a#toggle_effect_button4").click(function(){ $("#toggle_effect4").toggle('blind',500); return false; }); $("a#toggle_effect_button5").click(function(){ $("#toggle_effect5").toggle('blind',500); return false; }); $("a#toggle_effect_button6").click(function(){ $("#toggle_effect6").toggle('blind',500); return false; }); $("a#toggle_effect_button7").click(function(){ $("#toggle_effect7").toggle('blind',500); return false; }); $("a#toggle_effect_button8").click(function(){ $("#toggle_effect8").toggle('blind',500); return false; }); How can I boilerplate code like this? They all refer to similar links that controller the jQueryUI toggle action on DIV containers. If I assign a class to the "toggle_effect_button" hyperlinks is there a way to locate the correct DIV and toggle it? Or am I already doing this in the most concise way? Thanks for your help ~sm
[jQuery] Validation
I have seriously been fighting this issue for hours. I would appreciate some advice when someone gets a chance. I am wanting to check my database to determine if this user already exists. I thought I could just add the method to the validation. Evidently I'm doing something wrong. Here is the code. script type=text/javascript $(document).ready(function(){ var checkName = (function(value){ var dataString = '?mode=checkUserusername=' + username.val(); $.ajax({ type: GET, url: user_formsubmit.php + dataString, success: function(html){ if(html == True) { return true; } else { return false; } } }); }); $.validator.addMethod(checkName, function(value, element){ return checkName(value); }, This user name already exists.); $(#user_form).validate({ rules: { userName: { required: true, minlength: 8, checkName: false },
[jQuery] Re: Sort columns with URL in Tablesort
No em presently, was just using as possiable examples. The table I am working with now contains either numerical digits or text within a a hrefa/. the numbers sort perfectly, but the columns with the links seem to order based and the link and not the data itself in the cell. What I wrote above is exactly like the data. I'll try and post the exact table data tomorrow. On Oct 27, 12:08 pm, MorningZ morni...@gmail.com wrote: where is the em at? like here is what you need to post table thead trHeader Row/tr /thead tbody 5 or so rows of various data /tbody /table don't worry about posting your parser code, as obviously it has issues and if you want to keep the HTML intact without Google Groups messing with it, post the HTML on a site likehttp://jsbin.com or the like On Oct 27, 11:58 am, ChaosAD chao...@gmail.com wrote: Not entirely sure what you mean by removed all the white space. Could you please elaborate. On Oct 27, 11:39 am, Jacob jste...@gmail.com wrote: I recently had the same problem of links sorting by the URL, but I discovered that if I removed all the white space within the cell in my HTML it would sort by the text and not the URL. I don't know if that will help you with em tags as well, but it solved the problem for links for me. On Oct 27, 7:53 am, ChaosAD chao...@gmail.com wrote: Here is example of table presently working on. I using the code below, but getting error message: $(document).ready(function() { // call the tablesorter plugin $(table).tablesorter({ // define a custom text extraction function textExtraction: function(node) { // extract data from markup and return it return node.childNodes[0].childNodes[0].innerHTML; } }); }); Error: node.childNodes[0].childNodes[0] is undefined Example row: td54/tdtd34/tdtda hred='something' target='_blank'blah/ a/td On Oct 26, 6:55 pm, ChaosAD chao...@gmail.com wrote: Thanks, I will tomorrow when back at work. Right now it is data in td themselves and links inside as well. I want to make it flexable though so it can handle other types such as em etc. On Oct 26, 6:26 pm, MorningZ morni...@gmail.com wrote: Perhaps post an example of the table's HTML and it would (much) easier to help as your first post mentioned a tags and you implied it was nothing but those, now you have em or no tag at all, quite a bit more complicated now On Oct 26, 4:45 pm, ChaosAD chao...@gmail.com wrote: Thanks for the reply. My problem is rising from the fact that not all column are url based. Some are straight data and some others might have other tags such as em around them. I tried following the example for custom parser and I kept getting s integer errors. Sorry if this is simple problem, I am very nice to jquery and especially tablesort. On Oct 26, 4:36 pm, MorningZ morni...@gmail.com wrote: You'll need to write a custom Parser so that you get what's inside the a tag and not the string itself... It's very easy to do if you just follow his example on the site On Oct 26, 3:00 pm, ChaosAD chao...@gmail.com wrote: I'm fairly new to Tablesort, but got it working for the most part. The only problem I have is any columns that have a a href/a in them. It seems to sort it based on the url and not that actual data in the cell. How do I get it to sort based on the data and not the url?
[jQuery] blockUI not working with layout
I am trying to block the whole page, but blockUI is not working with my layout (like the simple layout in demo). - Regards, Indraneel
[jQuery] Re: Validation
Read this documentation page on try to achieve what you want: http://docs.jquery.com/Plugins/Validation/Methods/remote On Oct 27, 1:08 pm, Ryan cowdo...@gmail.com wrote: I have seriously been fighting this issue for hours. I would appreciate some advice when someone gets a chance. I am wanting to check my database to determine if this user already exists. I thought I could just add the method to the validation. Evidently I'm doing something wrong. Here is the code. script type=text/javascript $(document).ready(function(){ var checkName = (function(value){ var dataString = '?mode=checkUserusername=' + username.val(); $.ajax({ type: GET, url: user_formsubmit.php + dataString, success: function(html){ if(html == True) { return true; } else { return false; } } }); }); $.validator.addMethod(checkName, function(value, element){ return checkName(value); }, This user name already exists.); $(#user_form).validate({ rules: { userName: { required: true, minlength: 8, checkName: false },
[jQuery] Re: blockUI not working with layout
Got anything more to go on? link to live example? something, anything, more than doesn't work? Is it any browser? On Oct 27, 8:24 pm, Indraneel indraneel.ra...@gmail.com wrote: I am trying to block the whole page, but blockUI is not working with my layout (like the simple layout in demo). - Regards, Indraneel
[jQuery] Re: Superfish - Supersubs not being recognized?
Replying to my own thread here. I figured out the issue. I was using this in a Wordpress installation and the issue was with wp_head() loading jquery.js after my jQuery code. This rendered everything useless until I put the code block under the wp_head() call and all worked fine. Thanks to the authors for an awesome plugin! On Oct 26, 2:08 am, net-genius ipru...@gmail.com wrote: Hello, I am using jQuery Superfish (withSupersubs) but I'm getting an JS error when loading the page: Error: $(ul#topmenu).supersubsis not a function I looked at thesupersubs.js file but I can't figure out what the problem is. I'm calling jquery.js, jquery.superfish.js, and jquery.supersubs.js on the head and initiating menu as suggested: $(document).ready(function(){ $(ul#topmenu).supersubs({ minWidth: 12, maxWidth: 27, extraWidth: 1 }).superfish(); }); Can someone please help with this? Thank you!
[jQuery] Re: (validate) validator is undefined error
Change var validator = $(#surveyForm).validate({ to var validator = $(form).validate({ or form action=?event=submitSurvey method=post fieldset id=surveyForm to form id=surveyForm action=?event=submitSurvey method=post fieldset Good luck. On Oct 28, 7:54 am, Collectonian collecton...@gmail.com wrote: I'm trying to implement Validate on a survey form that has just a few basic requirements. I'm running jQuery 1.3.2 and Validate 1.5.5. Whenever I try to run the code, however, I get an error that validator is undefined. I tried Googling and found only a few hits, most saying the HTML was invalid. Checked that, corrected a few minor errors, but still getting the error. In addition to the code below, I tried just the basic $(#surveyForm).validate() but it still gives the same error. This is on a development application, so it isn't available online yet. Summer SNIPPET FROM JS FILE var validator = $(#surveyForm).validate({ rules: { recommend: required, howlearnedother: { required: function(element) { return $('#howlearned input[name=howlearned]:checked').val() == 0; } }, describeyouother: { required: function(element) { return $('#describeyouother input [name=describeyouother]:checked').val() == 0; } } }, messages: { recommend: Please indicate if you would recommend the SRAC site to others, howlearnedother: Please indicate how you learned about SRAC's publications., describeyouother: Please indicate your industry. } }); ~~~SNIPPET OF HTML FORM form action=?event=submitSurvey method=post fieldset id=surveyForm legendPlease complete this survey to help us improve our offerings:/legend label for=recommendWhat is the likelihood that you would recommend the SRAC web site or its publications to your family and friends? Choose one number below with 1 = not likely and 10 = highly likely./label div id=recommend input name=recommend type=radio value=1 / 1 input name=recommend type=radio value=2 / 2 input name=recommend type=radio value=3 / 3 input name=recommend type=radio value=4 / 4 input name=recommend type=radio value=5 / 5 input name=recommend type=radio value=6 / 6 input name=recommend type=radio value=7 / 7 input name=recommend type=radio value=8 / 8 input name=recommend type=radio value=9 / 9 input name=recommend type=radio value=10 / 10 /div label for=howlearnedHow did you learn about SRAC publications? /label div id=howlearned input name=howlearned type=radio class=checksandradios value=1 / Linked from another web sitebr / input name=howlearned type=radio class=checksandradios value=2 / Search enginebr / input name=howlearned type=radio class=checksandradios value=3 / Professional (e.g. Fisheries/aquaculture biologists)br / input name=howlearned type=radio class=checksandradios value=4 / Extension programbr / input name=howlearned type=radio class=checksandradios value=5 / Friendbr / input name=howlearned type=radio class=checksandradios value=6 / Magazinebr / input name=howlearned type=radio class=checksandradios value=7 / Bookbr / input name=howlearned type=radio class=checksandradios value=0 / Other input id=howlearnedother name=howlearnedother value= type=text size=30 maxlength=30 /br / /div label for=whyvisitWhy did you visit the SRAC web site?/label div id=whyvisit input
[jQuery] [Autocomplete] - Issue with DOCTYPE?
Hi guys, Currently I'm using this version of autocomplete plugin http://bassistance.de/jquery-plugins/jquery-plugin-autocomplete/ for some of my php files. I found an issue with the autocomplete dropdown that it showed all the html tags as results instead of the data from the database. Something like...!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd;...Was wondering what went wrong here since I've it implemented for another web page and it worked absolutely fine. In http://bassistance.de/jquery-plugins/jquery-plugin-autocomplete/, I also found similar post about the issue by HESHAM. Any advice? Thanks