[jQuery] Re: blockUI custom options not working
Just about anything, if not all, you do with jQuery requires or makes the most sense to have the DOM to be ready, it should be as automatic as it gets writing that first line of code ...and the best way to make sure people who are new to JQuery understand this is if it is made more clear on the demos page and in documentation
[jQuery] Re: New to Jquery : Using it on dynmaically created divs
Hi again, Jonathan - I have tried that function in replace of my own and it doesn't seem to work :-s Any ideas? Thanks, James On Oct 23, 9:30 pm, ricardobeat [EMAIL PROTECTED] wrote: A more resilient solution is to use class names instead, you can't just drop/ignore the IDs altogether: div class=titleProduct 8234/div (with background-image: url(downarrow.gif) on CSS) div class=descriptionbla bla bla bla/div $('div.title').click(function(){ var arrow = ( $(this).next('.description').is(':visible') ) ? 'url(downarrow.gif')' : 'url(uparrow.gif')'; $(this).css('backgroundImage',arrow); $(this).next('.description').slideToggle(); }); - ricardo On Oct 23, 1:31 pm, Jonathan Sharp, Out West Media jquery- [EMAIL PROTECTED] wrote: Hi James, Here's one way to rewrite it using jQuery: function divShowHide(divID, imgID) { var d = $('#' + divID).toggle(); $('#' + imageID).attr('src', 'Images/' + ( d.is(':visible') ? 'down' : 'up' ) + 'arrow.png' ); } Cheers, -Jonathan On Oct 23, 2008, at 8:42 AM, James2008 wrote: Hi. At the moment I've creating 2 divs for each record in a database. One to first give a title for that piece of information and the second to be a show/hide div that gives furthur information upon clicking a little arrow. I generate both divs server side on an updatepanel refresh. I have them showing/hiding at the moment using this function... function divShowHide(divID, imgID){ // Hides/Shows the second div and changes arrow appearance var divToChange = document.getElementById(divID); if(divToChange.style.display == block) { divToChange.style.display = none; document.getElementById(imgID).src = Images/downarrow.png; } else { divToChange.style.display = block; document.getElementById(imgID).src = Images/uparrow.png; } } I was wandering if I could incorporate Jquery into this function to make it do the job , or if all the divs have to be created in the head section with jquery beforehand?? I have tried using the show/hide commands in the above function using Jquery but they don't seem to work. Each of my second divs have a unique ID, I just need to know if it's possible to do it in this way?? All the examples on the site use pre-defined names for divs but as I do not know the ammount of div sets before so can't do that. They are all called div2 + a unique identifyier. Any help would be greatly appreciated. Thanks, James
[jQuery] Re: Disabling Enter key on the page
Thanks. That worked :) I should get into the habit of using this 'is()' function. very convenient. On 23 oct, 18:07, Richard D. Worth [EMAIL PROTECTED] wrote: You can check the target of the keypress, by e.target. Something like this (untested): $(#body).keypress(function(e) { if (e.which == 13 !$(e.target).is(textarea)) { return false; } }); - Richard On Thu, Oct 23, 2008 at 12:37 PM, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi, I'm not completely sure this is a jQuery issue or a javascript issue. Pardon me if I'm not in the right place. I have disabled the Enter key on the page like that : $(#body).keypress(function(e) { if (e.which == 13) { return false; } }); Now the issue I'm facing is that if the user is typing in a textarea control, she can't type the Enter key anymore to do a new line ! Does anyone know how i can get around that ? Thanks
[jQuery] Re: My first attempt at showing/hiding div with jQuery
On 24 Ott, 03:52, dsizemore [EMAIL PROTECTED] wrote: Hi, In my first attempt at showing and hiding a div with jQuery, I've hacked together this code and I'm looking for any thoughts on what I did wrong (if anything?) The code seems to work in FireFox, IE7, and Safari/Chrome. Opera and IE6 seem to work at random, so I'm not exactly sure what's up with them, but I assume my code is flawed? hi :) your code's fine. just one pointer, if you use the id, you don't need the tag. so instead of $('a#subscribeRollover'), you can write simply: $('#subscribeRollover') it's not wrong, simply redundant. should be a bit faster, too, I think.
[jQuery] Re: [validate] remote rule send field value by POST instead GET
Ok, I now use a similar tech ( zajaj ) I made the question to integrate all the validations in a Only One routine. thanks 2008/10/23 Jörn Zaefferer [EMAIL PROTECTED] Currently there is no good option to customize the request. The easiest way may be using $.ajaxSetup, though that affects all requests. $.ajaxSetup({ type: post }); Jörn On Thu, Oct 23, 2008 at 11:04 PM, Àlex Corretgé [EMAIL PROTECTED] wrote: Hi, I have a hidden field in a form that contain the JSON view of the form values. The Submit button fill it before the $('#form').submit(); I have some rules created by the user in a database, and I try to use Validator to manage this 'user validations' sending to a remote rule handler the 'validation formula' and the field that contains all the form data. all data is send by GET method. Reading this doc: http://www.boutell.com/newfaq/misc/urllength.html I view that IE only manage 2048 chars for url and I'm worried. Is possible to send the value of the field tiggered with a remote rule by POST method? -- Atentament / Kind Regards Àlex Corretgé Serveis Informàtics Corretgé.com SLU http://corretge.cat/ LinkedIn: http://www.linkedin.com/in/corretge -- Atentament / Kind Regards Àlex Corretgé Serveis Informàtics Corretgé.com SLU http://corretge.cat/ LinkedIn: http://www.linkedin.com/in/corretge
[jQuery] Re: My first attempt at showing/hiding div with jQuery
Hi Try adding return false into your click handlers to stop the browser calling the url in the href' $(#rssInfo).hide(); $(a#subscribeRollover).click(function () { $(#rssInfo).show(fast); return false; }); $(a#rssInfoClose).click(function () { $(#rssInfo).hide(fast); return false; }); Paul On Oct 24, 2:52 am, dsizemore [EMAIL PROTECTED] wrote: Hi, In my first attempt at showing and hiding a div with jQuery, I've hacked together this code and I'm looking for any thoughts on what I did wrong (if anything?) The code seems to work in FireFox, IE7, and Safari/Chrome. Opera and IE6 seem to work at random, so I'm not exactly sure what's up with them, but I assume my code is flawed? .
[jQuery] toggle close open link
How do I create toggle button that changes its text and image. I tried the following but it does not work. style type=text/css span.open{background-image:url('img/open.gif');background-repeat:no- repeat; width:20px} span.close{background-image:url('img/close.gif');background-repeat:no- repeat; width:20px} /style a id=toggleLnk href=javascript: toggleOpenClose()Open Thisspan class=openP/span/a function toggleOpenClose() changes the class name and text as follows: a id=toggleLnk href=javascript: toggleOpenClose()Close Thisspan class=closeM/span/a function toggleOpenClose(){ var cls = $(#toggleLnk + span).attr('class'); if(cls == 'openP') { $(#toggleLnk + span).removeClass(openP); $(#toggleLnk + span).addClass(closeM); setHTML(document, toggleLnk, 'Close This'); } else if(cls == 'closeM') { $(#toggleLnk + span).removeClass(closeM); $(#toggleLnk + span).addClass(openP); setHTML(document, toggleLnk, 'Open This'); } }
[jQuery] xml find element with this attribute value
hello all. i've been reading a lot and still does not find any solution to my query. please find the details below. list sample name=a id=1/ sample name=b id=2/ /list in jquery how can i automatically find the element sample with attribute name equals to a without looping entirely the xml hope to find solution thanks. akel
[jQuery] Dimension plugin added to jQuery core 1.2.6 is giving different results on IE and mozilla
Hi All, I am writing a custom suggestbox using jQuery core version 1.2.6 (just for learning purpose). The problem I am facing is to nicely position my dynamically populated list (using ajax) on the input box. I used the offset() method from dimensions plugin, and it is giving me nice results in Firefox 3 and Chrome browsers, but it is misplaced in IE 7. Please reply how should I use this method (or any other methods) to properly position my list on suggest box in any given browser. Below is my html code, html head meta http-equiv=Content-Type content=text/html; charset=ISO-8859-1 titleTest page/title script type=text/javascript src=%= request.getContextPath() %/ includes/jQuery/jquery-1.2.6-min.js/script script type=text/javascript var index = -1; $( function() { $(#autocompleteOptions).hide(); $(#autocompleteInput) .click( function(event) { var result = $(#autocompleteInput).position(); $(#autocompleteOptions) .html(lidynamic1/lilidynamic2/lilidynamic3/li) .filter(#autocompleteOptions li) .css({position : absolute, top : result.top, left : result.left}) .hover( function(event) { $(#autocompleteOptions li).removeClass(redHighlight); if($(event.target).is(li)) { $(event.target).addClass(redHighlight); index = $(#autocompleteOptions li).index($ (event.target)); } }, function(event) { $(#autocompleteOptions li).removeClass(redHighlight); if($(event.target).is(li)) { $(event.target).removeClass(redHighlight); index = $(#autocompleteOptions li).index($ (event.target)); } } ); $(#autocompleteOptions).show(normal); } ) .keydown( function(event) { var keyCode = getKeyCode(event); var size = $(#autocompleteOptions li).size(); if(keyCode == 40) { if(index (size - 1)) { $(#before).val(index); $(#autocompleteOptions li).removeClass(redHighlight); index++; var option = $(#autocompleteOptions li).get(index); $(option).addClass(redHighlight); $(#after).val(index); } } if(keyCode == 38) { if(index = 1) { $(#before).val(index);
[jQuery] Ajax form submitting help
Iv got this form that allows you to select some files on your computer, when submitted the php behind it processes the the form and return some text. What i would like to accomplish is though Ajax submit the form, grab the text that is returned and put it in a textarea (that is already hidden on the page, and will be unhidden when the form submit) I cant seem to find how to do this. if someone could point me in the right direction that would be great. thanx.
[jQuery] Embedding HTML inside of XML, and writing it to a page
So I'm grabbing some content from an xml file. Actually, to be specific, an article, the layout is essentially: article titleThis title is rad./title text And this is some awesome article text. /text /article Only thing is, I want the article text to be xhtml-enabled. so there's b's and br/'s and such in there, and we're looking at something more like article titleThis title is rad./title text And this is some bawesome/b article text.br/ It's HTML formatted though, ithat could pose a problem/i. /text /article I want to grab ALL of the text content inside of the text node, and just carte blanche throw it in the page. So.. how can I do that? .text() strips out all the html entities, .html() works what I can best describe as 'intermittently', and is unsupported for xml documents (only supported for html docs) what can i use to just tell js/jquery to find everything between text and /text, and stick it in the DOM as xhtml, tags included?
[jQuery] Re: New to Jquery : Using it on dynmaically created divs
I've now got the divs sliding with this very simple code : function divShowHide(divID, imgID){ // Hides/Shows the vehicle details div and changes arrow appearance var divToChange = document.getElementById(divID); var arrowToChange = document.getElementById(imgID); $(divToChange).slideToggle(slow) } As you can see I still haven't got the arrows to work. I obviously need to toggle the src of the image as well as the slide movements for the div. How can I do this??? Thanks, James On Oct 24, 8:56 am, James2008 [EMAIL PROTECTED] wrote: Hi again, Jonathan - I have tried that function in replace of my own and it doesn't seem to work :-s Any ideas? Thanks, James On Oct 23, 9:30 pm, ricardobeat [EMAIL PROTECTED] wrote: A more resilient solution is to use class names instead, you can't just drop/ignore the IDs altogether: div class=titleProduct 8234/div (with background-image: url(downarrow.gif) on CSS) div class=descriptionbla bla bla bla/div $('div.title').click(function(){ var arrow = ( $(this).next('.description').is(':visible') ) ? 'url(downarrow.gif')' : 'url(uparrow.gif')'; $(this).css('backgroundImage',arrow); $(this).next('.description').slideToggle(); }); - ricardo On Oct 23, 1:31 pm, Jonathan Sharp, Out West Media jquery- [EMAIL PROTECTED] wrote: Hi James, Here's one way to rewrite it using jQuery: function divShowHide(divID, imgID) { var d = $('#' + divID).toggle(); $('#' + imageID).attr('src', 'Images/' + ( d.is(':visible') ? 'down' : 'up' ) + 'arrow.png' ); } Cheers, -Jonathan On Oct 23, 2008, at 8:42 AM, James2008 wrote: Hi. At the moment I've creating 2 divs for each record in a database. One to first give a title for that piece of information and the second to be a show/hide div that gives furthur information upon clicking a little arrow. I generate both divs server side on an updatepanel refresh. I have them showing/hiding at the moment using this function... function divShowHide(divID, imgID){ // Hides/Shows the second div and changes arrow appearance var divToChange = document.getElementById(divID); if(divToChange.style.display == block) { divToChange.style.display = none; document.getElementById(imgID).src = Images/downarrow.png; } else { divToChange.style.display = block; document.getElementById(imgID).src = Images/uparrow.png; } } I was wandering if I could incorporate Jquery into this function to make it do the job , or if all the divs have to be created in the head section with jquery beforehand?? I have tried using the show/hide commands in the above function using Jquery but they don't seem to work. Each of my second divs have a unique ID, I just need to know if it's possible to do it in this way?? All the examples on the site use pre-defined names for divs but as I do not know the ammount of div sets before so can't do that. They are all called div2 + a unique identifyier. Any help would be greatly appreciated. Thanks, James
[jQuery] Re: xml find element with this attribute value
On Oct 24, 2008, at 2:35 AM, akel wrote: i've been reading a lot and still does not find any solution to my query. please find the details below. list sample name=a id=1/ sample name=b id=2/ /list in jquery how can i automatically find the element sample with attribute name equals to a without looping entirely the xml jQuery supports a kind of XPath syntax, so: $(/list/[EMAIL PROTECTED]'a']) best, -Rob
[jQuery] Re: Need solution to cycle through images and display a caption
Hi, Just had a look at your site - very nice. I see the text is fading in and out in synch with the images. You can control the text independently using the callbacks. Try this: $('#slideshow').cycle({ before: onBefore, after: onAfter }); function onBefore() { $('p').hide(); } function onAfter() { $('p').css({opacity: '0.5'}).slideDown('slow'); } This hides the text before the image fades, and then slides the text in after the new image shows. You can also apply CSS to the p element to position it on top of the image. Paul On Oct 8, 7:53 pm, deronsizemore [EMAIL PROTECTED] wrote: That you very much Karl for chiming in here! I feel like an idiot now though as that was so simple. I can't believe I didn't even think of that. I guess I was thinking that the fade effect would only do images for some reason so adding a caption wrapped in a paragraph tag never entered my mind. I have it working now at:http://www.kentuckygolfing.com I do have a couple more questions though. 1. How do you go about changing the opacity of the caption background color as well as making that whole caption slide up from the bottom on the example site you supplied earlier? I tried to dissect your code but couldn't find this anywhere. I tried to duplicate it myself but my limited knowledge just won't allow it yet. 2. It seems that on my site, when you refresh the page there is a slight flicker where it shows the second image caption first but then quickly switches back to the first caption, which is the right one. I noticed that yours doesn't do this. Any ideas? Initially on my site too, both images in the li were being shown above one another until the script loaded fully. I got around this by adding overflow: hidden to the containing ul but can't figure out the caption flicker issue. 3. Last, if you watch on my site closely, when the caption appears, the text goes from normal (with no Anti-Alias) to smooth (with Anti-Alias). I noticed that your example does not. Is there something I'm doing wrong there too? Thanks for your help on this. I'm much farther along that I ever have been before. I'm really looking forward to your book Learning jQuery too. Hopefully I wont' have to ask these beginner questions in future. ;) Deron Karl Swedberg-2 wrote: The cycle plugin is excellent. It can have anything you want for each item -- image, caption, whatever. You apply the method to a container element, and the child elements are cycled. So, you could have this, for example: jQuery: ... $('#mycontainer').cycle(); ... HTML: ... ul id=mycontainer li foo.jpg pI'm a caption./p /li li bar.jpg pI'm another caption./p /li /ul ... If you'd like to see an example of this in the wild, I used the cycle plugin here: http://www.canons-regular.org/ --Karl Karl Swedberg www.englishrules.com www.learningjquery.com On Oct 8, 2008, at 11:03 AM, deronsizemore wrote: Thank you very much. I did see it the other day but I didn't notice anything where it allowed you to add in a caption. I'm going back to take a second look. I'm currently trying to read through the Learning jQuery book, so hopefully if Cycle doesn't have captions built in, I'll be able to add that functionality myself soon. Paul Mills-12 wrote: Hi, You could try the cycle plugin: http://plugins.jquery.com/project/cycle The documentation is very good with lots of examples. You can use the before and after callback functions to show/hide the caption and CSS to position the caption on top of the image. Paul On Oct 6, 12:44 am, deronsizemore [EMAIL PROTECTED] wrote: Hi, I'm looking for plugin that will allow cycling through images and display a caption for each image. What I'm looking for is exactly like this example:http://www.woothemes.com/demo/?t=3 The image on the top left cycles through different images and displays a unique caption for each image. Is there anything out there like this for jQuery? I believe the example above used this mootools plugin I believe:http://smoothgallery.jondesign.net/getting-started/gallery-set-howto/ Currently, I'm using jQuery Innerfade tocyclethrough images, but I'm having to manually insert captions via Photoshop and it's just getting to be a bit tedious. Thanks -- View this message in context:http://www.nabble.com/Need-solution-to-cycle-through-images-and-displ ... Sent from the jQuery General Discussion mailing list archive at Nabble.com. -- View this message in context: http://www.nabble.com/Need-solution-to-cycle-through-images-and-displ... Sent from the jQuery General Discussion mailing list archive at Nabble.com. -- View this message in context:http://www.nabble.com/Need-solution-to-cycle-through-images-and-displ... Sent from the
[jQuery] Re: Get label text
I wrote alert(levels) to check and I get: [object Object] Does anyone knows how to get the values and join in CSV format? Thank You, Miguel On Oct 24, 1:47 am, shapper [EMAIL PROTECTED] wrote: yes, I have: var levels = []; levels = $('input:checked + label').map(function() { return $(this).text(); }); ... .append(levels.join(',')) Still having the same error ... On Oct 24, 1:04 am, William [EMAIL PROTECTED] wrote: Perhaps use .append(labels.join(',')) Note that the snippet from Klaus uses var *labels*, so trying to use the Array.join method of *levels* (probably undefined) will likely not work ;) On Oct 23, 2:58 pm, shapper [EMAIL PROTECTED] wrote: But I can join the labels can't I? I tried: .append(levels.join(', ')) to added it to an element and I get the error in Firebug: levels.join is not a function Am I doing something wrong? Thanks, Miguel On Oct 23, 9:57 pm, Klaus Hartl [EMAIL PROTECTED] wrote: You could try this (untested): var labels = $('input:checked + label').map(function() { return $(this).text(); }); That should give you an array with the label's text. --Klaus On 23 Okt., 22:47, shapper [EMAIL PROTECTED] wrote: Hello, This might be a tricky one ... I have been looking into JQuery docs but I can't figure how to make this. I have the following: input type=checkbox name=Roles id=Admin value=Admin / label for=AdminAdministrator/label input type=checkbox name=Roles id=Coll value=Admin / label for=CollCollaborator/label How can I get, NOT the values, of all checked boxes BUT the label inner text of all checked boxes? Example: If Coll checkbox is checked I would get: Collaborator If both checkboxes are checked I would get: Collaborator, Administrator Could someone, please, help me? Thank You, Miguel
[jQuery] Re: Embedding HTML inside of XML, and writing it to a page
On Oct 23, 2008, at 11:09 PM, Recoil wrote: Only thing is, I want the article text to be xhtml-enabled. so there's b's and br/'s and such in there, and we're looking at something more like article titleThis title is rad./title text And this is some bawesome/b article text.br/ It's HTML formatted though, ithat could pose a problem/i. /text /article I want to grab ALL of the text content inside of the text node, and just carte blanche throw it in the page. No, from what you say below you don't want the text, you want all the nodes: text, elements, etc. So.. how can I do that? .text() strips out all the html entities, .html() works what I can best describe as 'intermittently', and is unsupported for xml documents (only supported for html docs) what can i use to just tell js/jquery to find everything between text and /text, and stick it in the DOM as xhtml, tags included? The *best* way to handle this type of thing (if you are up for it) is to use XSL, which works in all browsers. You are looking for the a modified 'identity transform'. Basically, a modified identity transform allows you to recursively copy everything you do not override by a template match. An example XSL that does what you want: ?xml version=1.0 encoding=UTF-8? xsl:stylesheet xmlns:xsl=http://www.w3.org/1999/XSL/Transform; version=1.0 xsl:template match=/ xsl:apply-templates/ /xsl:template xsl:template match=article div class=article xmlns=http://www.w3.org/1999/xhtml; xsl:apply-templates/ /div /xsl:template xsl:template match=title h1 xmlns=http://www.w3.org/1999/xhtml; xsl:apply-templates/ /h1 /xsl:template xsl:template match=text xsl:apply-templates/ /xsl:template !-- Identity template: copies everything not overridden/matched in other templates -- xsl:template match=@*|node() xsl:copy xsl:apply-templates select=@*/ xsl:apply-templates/ /xsl:copy /xsl:template /xsl:stylesheet
[jQuery] Re: trying to get ajaxForm to use a dynamic class or id to prependTo
And here is the current setup of codehttp://www.pastie.org/299446 You forgot to declare 'responseText' as an argument to your success handler function.
[jQuery] Re: trying to get ajaxForm to use a dynamic class or id to prependTo
malsup wrote: And here is the current setup of codehttp://www.pastie.org/299446 You forgot to declare 'responseText' as an argument to your success handler function. shoot! Ok, updated. http://www.pastie.org/299610 So now that starts to work. But the Problem of the code knowing which .new_review is selected. Right now it seems to pick the first and thats it. With out $(this) or scoping the current form I have no clue how to get it to target te proper ID. Thank you for your help throughout this. -- View this message in context: http://www.nabble.com/trying-to-get-ajaxForm-to-use-a-dynamic-class-or-id-to-prependTo-tp20135944s27240p20149330.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: How to stop change event from firing
No test page, but I did manage to get it working. Turns out I had a line at the start of my updateCity function which was setting the state value back to the first option after the updateState had finished doing its thing. So in fact, the function from my original post works fine now that the state is not being overwritten. My bad! So I can confirm that $('#field-state').val('idaho') works as it should. Again, thanks for following up. On Oct 23, 10:58 pm, ricardobeat [EMAIL PROTECTED] wrote: This usually works: select id=field-state option value=coloradoColorado/option option value=idahoIdaho/option /select $('#field-state').val('idaho') or $('#field-state option[value=idaho]').attr('selected','selected') or var state = 'idaho'; $('#field-state').find('option[value='+state +']').attr('selected','selected'); could you provide a test page exhibiting your problem? - ricardo On Oct 23, 9:29 am, newkid85 [EMAIL PROTECTED] wrote: Thanks for the tip, ricardo. I've decided to initialise the dropdowns with the existing form values before triggering a clickevent, but I've run into another problem. I can't seem to set the selected option. I've tried the following with a hardcoded value for state without any luck. $('#field-state').val(state); $(#field-state).val(state).attr(selected,selected); $(#field-state [EMAIL PROTECTED]).attr(selected,selected); Yet the dropdowns always have the first item in the options selected. Interestingly, the following works if you need to set the dropdown to select the ' ' option. $('#field-state').val(' '); Any other value just won't keep though. Seems like this is a common problem based on some googling. Anyone else encountered this and found a workaround? On Oct 17, 7:10 pm, ricardobeat [EMAIL PROTECTED] wrote: You can do $(#field-state).unbind('change'); when it starts being edited and bind the function again when it's done, or you can put everything in the function inside an IF statement which depends on the edit mode. - ricardo On Oct 17, 12:41 pm, newkid85 [EMAIL PROTECTED] wrote: I have a form with three dependent location select fields and a text field which lets a user add a new city if it is missing from the dropdown. The following function works fine when I create a new form. It puts the fields in sync to start with and keeps them that way when the user makes their selections. There is a problem though when the form is edited. This is because once the page loads the function below automatically puts the fields back in sync before the user does anything like on the initial creation. So the previously selected values are overwritten. When the form is being edited I would like to have thechangeevent only fire if the user actually changes any of the dropdowns themselves. I am able to check if the form is being edited or created but not sure how tochangemy function. function() { $(#update-button).hide(); if ($(#field-city-text).val() == '') { $(#field-city-text-wrapper).hide(); } $(#field-country).change(function () { var country = $(this).val(); $(#field-city-wrapper).hide(); $(#field-city).val(''); updateState(); }) .change(); $(#field-state).change(updateCity).change(addCity); $(#field-city).change(addCity); } Any thoughts appreciated.
[jQuery] Re: trying to get ajaxForm to use a dynamic class or id to prependTo
With out $(this) or scoping the current form I have no clue how to get it to target te proper ID. So you need access to the form element? In one of your other examples you had correctly discovered that the 3rd arg to your success handler is the form element (wrapped in a jQuery ojbect). So you could do something like this to make your code generic: success: function(responseText, status, $form) { var id = '#review_' + $form.attr(id); $(responseText).prependTo(id).effect(highlight, {}, 9000); } Mike
[jQuery] Re: toggle close open link
Hello bob. how your setHTML() function works ? Is this use to change the text ? or why not you replace the text (Open / Close) ? like.. if(cls == 'openP') { $(#toggleLnk + span).removeClass(openP); $(#toggleLnk + span).addClass(closeM); var txt = $(#toggleLnk).html().replace('Open', 'Close'); $(#toggleLnk).html(txt); } else if(cls == 'closeM') { $(#toggleLnk + span).removeClass(closeM); $(#toggleLnk + span).addClass(openP); var txt = $(#toggleLnk).html().replace('Close', 'Open'); $(#toggleLnk).html(txt); } On Oct 24, 8:20 am, bobjqueryhm [EMAIL PROTECTED] wrote: How do I create toggle button that changes its text and image. I tried the following but it does not work. style type=text/css span.open{background-image:url('img/open.gif');background-repeat:no- repeat; width:20px} span.close{background-image:url('img/close.gif');background-repeat:no- repeat; width:20px} /style a id=toggleLnk href=javascript: toggleOpenClose()Open Thisspan class=openP/span/a function toggleOpenClose() changes the class name and text as follows: a id=toggleLnk href=javascript: toggleOpenClose()Close Thisspan class=closeM/span/a function toggleOpenClose(){ var cls = $(#toggleLnk + span).attr('class'); if(cls == 'openP') { $(#toggleLnk + span).removeClass(openP); $(#toggleLnk + span).addClass(closeM); setHTML(document, toggleLnk, 'Close This'); } else if(cls == 'closeM') { $(#toggleLnk + span).removeClass(closeM); $(#toggleLnk + span).addClass(openP); setHTML(document, toggleLnk, 'Open This'); } }
[jQuery] Re: blockUI custom options not working
...and the best way to make sure people who are new to JQuery understand this is if it is made more clear on the demos page and in documentation done.
[jQuery] Re: Ajax form submitting help
What i would like to accomplish is though Ajax submit the form, grab the text that is returned and put it in a textarea (that is already hidden on the page, and will be unhidden when the form submit) I cant seem to find how to do this. if someone could point me in the right direction that would be great. thanx. Use a 'success' handler to capture the response text and then set it as the value to your text area. Something like: $('#myForm').ajaxForm({ success: function(responseText) { $('#myTextarea').val(responseText).show(); } });
[jQuery] Re: jsonp to WCF problem
Thanks for the info. How exactly are you writing directly to the response using WCF? My IIS hosted WCF service is basically just acting like a proxy to a windows hosted WCF service, so they both use the same contract, but the IIS hosted service is a REST based service. Is there a way to maintain this uniformity of contracts, while writing directly to the response of the IIS service? On Oct 23, 8:22 am, tenaciousd [EMAIL PROTECTED] wrote: If you're going to do cross-domain calls you can't do a POST, only a GET. I think even if you specify POST as your type jQuery will convert it to a GET if your datatype is jsonp (check their doc but I'm pretty sure that's the case). As for WCF the key is just making sure that you wrap your return in the callback method and write it to the Response. In other words, you can't simply have a WCF endpoint that returns a json-formatted object. Instead you need to write something like callbackMethodName( + yourJSONObject + ); to the Response. Once you've done this jQuery will execute the callback call, in which it will do an eval() on yourJSONObject and then call the success method, passing it the JSON object in the data parameter. At that point you will have dot notation on your JSON object. On Oct 22, 7:31 pm, RWF [EMAIL PROTECTED] wrote: I am using WCF too, have you done projects that require an $.ajax POST request to a WCF service cross site? If you have, how did come up with a server proxy to allow for cross site communication? On Oct 10, 2:01 pm, tenaciousd [EMAIL PROTECTED] wrote: Nevermind. The fundamental issue was that the json object wrapped in the callback name does, in fact, need to be written to the Response. I'm an idiot. Anyway, it's working now. If others hit the same jquery -jsonp- wcf issue let me know. On Oct 10, 12:07 pm, tenaciousd [EMAIL PROTECTED] wrote: I'm using jQuery $.ajax to make a cross-domainjsonpcall to a WCF service. The call is working fine, entering the service endpoint, but the callback method never fires. I've tried many permutations of changes and can't seem to get this to work. The WCF endpoint is returning a string (NOT doing a Response.Write) that contains a json object inside the callback wrapper (e.g. jsonp123( {Author:John Doe,Price:$35.90} ) ) and the content- type returned from the service is application/json; charset=utf-8. $.ajax call is below. Any help is much appreciated. var data = {ISBN : $(#isbn1).val()}; $.ajax({ type: GET, cache: false, url: http://localhost:63132/Widget.svc/GetProductInfo;, scriptCharset: utf-8, dataType: jsonp, data: data, success: function(data, textStatus){ alert(success); }, error: function(XMLHttpRequest, textStatus, errorThrown){ alert('error'); } });
[jQuery] Re: Get label text
Ah, I forgot a little thing (documentation was a bit misleading on that). Try this: var levels = $('input:checked + label').map(function() { return $(this).text(); }).get(); For csv do: levels.join(','); And that's more or less the same as in the documentation ;-) http://docs.jquery.com/Traversing/map#callback --Klaus On 24 Okt., 14:03, shapper [EMAIL PROTECTED] wrote: I wrote alert(levels) to check and I get: [object Object] Does anyone knows how to get the values and join in CSV format? Thank You, Miguel On Oct 24, 1:47 am, shapper [EMAIL PROTECTED] wrote: yes, I have: var levels = []; levels = $('input:checked + label').map(function() { return $(this).text(); }); ... .append(levels.join(',')) Still having the same error ... On Oct 24, 1:04 am, William [EMAIL PROTECTED] wrote: Perhaps use .append(labels.join(',')) Note that the snippet from Klaus uses var *labels*, so trying to use the Array.join method of *levels* (probably undefined) will likely not work ;) On Oct 23, 2:58 pm, shapper [EMAIL PROTECTED] wrote: But I can join the labels can't I? I tried: .append(levels.join(', ')) to added it to an element and I get the error in Firebug: levels.join is not a function Am I doing something wrong? Thanks, Miguel On Oct 23, 9:57 pm, Klaus Hartl [EMAIL PROTECTED] wrote: You could try this (untested): var labels = $('input:checked + label').map(function() { return $(this).text(); }); That should give you an array with the label's text. --Klaus On 23 Okt., 22:47, shapper [EMAIL PROTECTED] wrote: Hello, This might be a tricky one ... I have been looking into JQuery docs but I can't figure how to make this. I have the following: input type=checkbox name=Roles id=Admin value=Admin / label for=AdminAdministrator/label input type=checkbox name=Roles id=Coll value=Admin / label for=CollCollaborator/label How can I get, NOT the values, of all checked boxes BUT the label inner text of all checked boxes? Example: If Coll checkbox is checked I would get: Collaborator If both checkboxes are checked I would get: Collaborator, Administrator Could someone, please, help me? Thank You, Miguel
[jQuery] Re: [validate] problems with invalid-form.validate and remote rules
Fixed! You're welcome to test it before the next release, you can find the latest revision here: http://jqueryjs.googlecode.com/svn/trunk/plugins/validate/ Jörn On Thu, Oct 23, 2008 at 10:49 PM, Àlex Corretgé [EMAIL PROTECTED] wrote: Ok Jörn, issue created http://dev.jquery.com/ticket/3516 thanks for all -- Atentament / Kind Regards Àlex Corretgé Serveis Informàtics Corretgé.com SLU http://corretge.cat/ LinkedIn: http://www.linkedin.com/in/corretge 2008/10/22 Jörn Zaefferer [EMAIL PROTECTED] Apart from the fact that this event needs to get exposed as an option, its also a bug that it isn't triggered by the remote method. Could you file a ticket for this? http://dev.jquery.com/newticket (requires registration) Thanks! Jörn On Wed, Oct 22, 2008 at 10:47 AM, corretge [EMAIL PROTECTED] wrote: Hi, I try to show a list of errors in an alert box when the form is cancelled by jQuery Validator. Surfing the web I see that I can use invalid-form.validate like this: $('#bpwcForm').bind('invalid-form.validate', function(e, validator) { var errors = validator.numberOfInvalids(); alert('ERR ' + errors); }); but this function is NOT executed when a submit form is cancelled by a remote rule. any suggestion or work-arround? thanks Àlex Corretgé
[jQuery] Re: jsonp to WCF problem
My service setup isn't exactly the same as yours but I think the same solution will work for you. You'll need to add two classes, one that inherits from Stream (we'll call is JsonStream) and another that inherits from the IHttpModule interface (we'll call this JsonModule). The JsonStream class will need a public property to store the name of the callback (e.g. CallbackFunctionName). JsonModule's Init needs to first look for all RequestType = GET and, for all such requests, do a GetValues on callback to see if the caller expects us to make a callback or simply return data. If a callback param is present we need to create a new instance of JsonStream passing the current context's Response.Filter to the constructor and then set CallbackFunctionName to the appropriate value. Then, in JsonStream in the overridden Write method, if CallbackFunctionName has a value you need to do something like (where _stream is the value passed into JsonStream's constructor): string content = CallbackFunctionName + ( + Encoding.UTF8.GetString(bugger) + );; _stream.Write(Encoding.UTF8.GetBytes(content), 0, content.Length); In this way you've decoupled the callback functionality from your WCF service(s) but it just works for cases that require it. Hopefully this implementation will work in your scenario. On Oct 24, 9:22 am, RWF [EMAIL PROTECTED] wrote: Thanks for the info. How exactly are you writing directly to the response using WCF? My IIS hosted WCF service is basically just acting like a proxy to a windows hosted WCF service, so they both use the same contract, but the IIS hosted service is a REST based service. Is there a way to maintain this uniformity of contracts, while writing directly to the response of the IIS service? On Oct 23, 8:22 am, tenaciousd [EMAIL PROTECTED] wrote: If you're going to do cross-domain calls you can't do a POST, only a GET. I think even if you specify POST as your type jQuery will convert it to a GET if your datatype is jsonp (check their doc but I'm pretty sure that's the case). As for WCF the key is just making sure that you wrap your return in the callback method and write it to the Response. In other words, you can't simply have a WCF endpoint that returns a json-formatted object. Instead you need to write something like callbackMethodName( + yourJSONObject + ); to the Response. Once you've done this jQuery will execute the callback call, in which it will do an eval() on yourJSONObject and then call the success method, passing it the JSON object in the data parameter. At that point you will have dot notation on your JSON object. On Oct 22, 7:31 pm, RWF [EMAIL PROTECTED] wrote: I am using WCF too, have you done projects that require an $.ajax POST request to a WCF service cross site? If you have, how did come up with a server proxy to allow for cross site communication? On Oct 10, 2:01 pm, tenaciousd [EMAIL PROTECTED] wrote: Nevermind. The fundamental issue was that the json object wrapped in the callback name does, in fact, need to be written to the Response. I'm an idiot. Anyway, it's working now. If others hit the same jquery -jsonp- wcf issue let me know. On Oct 10, 12:07 pm, tenaciousd [EMAIL PROTECTED] wrote: I'm using jQuery $.ajax to make a cross-domainjsonpcall to a WCF service. The call is working fine, entering the service endpoint, but the callback method never fires. I've tried many permutations of changes and can't seem to get this to work. The WCF endpoint is returning a string (NOT doing a Response.Write) that contains a json object inside the callback wrapper (e.g. jsonp123( {Author:John Doe,Price:$35.90} ) ) and the content- type returned from the service is application/json; charset=utf-8. $.ajax call is below. Any help is much appreciated. var data = {ISBN : $(#isbn1).val()}; $.ajax({ type: GET, cache: false, url: http://localhost:63132/Widget.svc/GetProductInfo;, scriptCharset: utf-8, dataType: jsonp, data: data, success: function(data, textStatus){ alert(success); }, error: function(XMLHttpRequest, textStatus, errorThrown){ alert('error'); } });
[jQuery] [validate] Time validation
Hi, Is there anyway to do Time validation using the validator plugin? (http://bassistance.de/jquery-plugins/jquery-plugin-validation/) It seems to have date validation but not for time... Any other options?
[jQuery] Re: jsonp to WCF problem
Er, bugger should've been buffer. Quite a typo. On Oct 24, 9:58 am, tenaciousd [EMAIL PROTECTED] wrote: My service setup isn't exactly the same as yours but I think the same solution will work for you. You'll need to add two classes, one that inherits from Stream (we'll call is JsonStream) and another that inherits from the IHttpModule interface (we'll call this JsonModule). The JsonStream class will need a public property to store the name of the callback (e.g. CallbackFunctionName). JsonModule's Init needs to first look for all RequestType = GET and, for all such requests, do a GetValues on callback to see if the caller expects us to make a callback or simply return data. If a callback param is present we need to create a new instance of JsonStream passing the current context's Response.Filter to the constructor and then set CallbackFunctionName to the appropriate value. Then, in JsonStream in the overridden Write method, if CallbackFunctionName has a value you need to do something like (where _stream is the value passed into JsonStream's constructor): string content = CallbackFunctionName + ( + Encoding.UTF8.GetString(bugger) + );; _stream.Write(Encoding.UTF8.GetBytes(content), 0, content.Length); In this way you've decoupled the callback functionality from your WCF service(s) but it just works for cases that require it. Hopefully this implementation will work in your scenario. On Oct 24, 9:22 am, RWF [EMAIL PROTECTED] wrote: Thanks for the info. How exactly are you writing directly to the response using WCF? My IIS hosted WCF service is basically just acting like a proxy to a windows hosted WCF service, so they both use the same contract, but the IIS hosted service is a REST based service. Is there a way to maintain this uniformity of contracts, while writing directly to the response of the IIS service? On Oct 23, 8:22 am, tenaciousd [EMAIL PROTECTED] wrote: If you're going to do cross-domain calls you can't do a POST, only a GET. I think even if you specify POST as your type jQuery will convert it to a GET if your datatype is jsonp (check their doc but I'm pretty sure that's the case). As for WCF the key is just making sure that you wrap your return in the callback method and write it to the Response. In other words, you can't simply have a WCF endpoint that returns a json-formatted object. Instead you need to write something like callbackMethodName( + yourJSONObject + ); to the Response. Once you've done this jQuery will execute the callback call, in which it will do an eval() on yourJSONObject and then call the success method, passing it the JSON object in the data parameter. At that point you will have dot notation on your JSON object. On Oct 22, 7:31 pm, RWF [EMAIL PROTECTED] wrote: I am using WCF too, have you done projects that require an $.ajax POST request to a WCF service cross site? If you have, how did come up with a server proxy to allow for cross site communication? On Oct 10, 2:01 pm, tenaciousd [EMAIL PROTECTED] wrote: Nevermind. The fundamental issue was that the json object wrapped in the callback name does, in fact, need to be written to the Response. I'm an idiot. Anyway, it's working now. If others hit the same jquery -jsonp- wcf issue let me know. On Oct 10, 12:07 pm, tenaciousd [EMAIL PROTECTED] wrote: I'm using jQuery $.ajax to make a cross-domainjsonpcall to a WCF service. The call is working fine, entering the service endpoint, but the callback method never fires. I've tried many permutations of changes and can't seem to get this to work. The WCF endpoint is returning a string (NOT doing a Response.Write) that contains a json object inside the callback wrapper (e.g. jsonp123( {Author:John Doe,Price:$35.90} ) ) and the content- type returned from the service is application/json; charset=utf-8. $.ajax call is below. Any help is much appreciated. var data = {ISBN : $(#isbn1).val()}; $.ajax({ type: GET, cache: false, url: http://localhost:63132/Widget.svc/GetProductInfo;, scriptCharset: utf-8, dataType: jsonp, data: data, success: function(data, textStatus){ alert(success); }, error: function(XMLHttpRequest, textStatus, errorThrown){ alert('error'); } });
[jQuery] Re: jsonp to WCF problem
thanks tenacious for all the help. It sounds like i would just ditch my IIS hosted WCF service, i was under the impression from this link: http://msdn.microsoft.com/en-us/library/cc716898.aspx that it was some how possible to rig WCF to format the response natively but the solution it referrers to does not exist in the samples download. On Oct 24, 9:00 am, tenaciousd [EMAIL PROTECTED] wrote: Er, bugger should've been buffer. Quite a typo. On Oct 24, 9:58 am, tenaciousd [EMAIL PROTECTED] wrote: My service setup isn't exactly the same as yours but I think the same solution will work for you. You'll need to add two classes, one that inherits from Stream (we'll call is JsonStream) and another that inherits from the IHttpModule interface (we'll call this JsonModule). The JsonStream class will need a public property to store the name of the callback (e.g. CallbackFunctionName). JsonModule's Init needs to first look for all RequestType = GET and, for all such requests, do a GetValues on callback to see if the caller expects us to make a callback or simply return data. If a callback param is present we need to create a new instance of JsonStream passing the current context's Response.Filter to the constructor and then set CallbackFunctionName to the appropriate value. Then, in JsonStream in the overridden Write method, if CallbackFunctionName has a value you need to do something like (where _stream is the value passed into JsonStream's constructor): string content = CallbackFunctionName + ( + Encoding.UTF8.GetString(bugger) + );; _stream.Write(Encoding.UTF8.GetBytes(content), 0, content.Length); In this way you've decoupled the callback functionality from yourWCF service(s) but it just works for cases that require it. Hopefully this implementation will work in your scenario. On Oct 24, 9:22 am, RWF [EMAIL PROTECTED] wrote: Thanks for the info. How exactly are you writing directly to the response usingWCF? My IIS hostedWCFservice is basically just acting like a proxy to a windows hostedWCFservice, so they both use the same contract, but the IIS hosted service is a REST based service. Is there a way to maintain this uniformity of contracts, while writing directly to the response of the IIS service? On Oct 23, 8:22 am, tenaciousd [EMAIL PROTECTED] wrote: If you're going to do cross-domain calls you can't do a POST, only a GET. I think even if you specify POST as your type jQuery will convert it to a GET if your datatype isjsonp(check their doc but I'm pretty sure that's the case). As forWCFthe key is just making sure that you wrap your return in the callback method and write it to the Response. In other words, you can't simply have aWCFendpoint that returns a json-formatted object. Instead you need to write something like callbackMethodName( + yourJSONObject + ); to the Response. Once you've done this jQuery will execute the callback call, in which it will do an eval() on yourJSONObject and then call the success method, passing it the JSON object in the data parameter. At that point you will have dot notation on your JSON object. On Oct 22, 7:31 pm, RWF [EMAIL PROTECTED] wrote: I am usingWCFtoo, have you done projects that require an $.ajax POST request to aWCFservice cross site? If you have, how did come up with a server proxy to allow for cross site communication? On Oct 10, 2:01 pm, tenaciousd [EMAIL PROTECTED] wrote: Nevermind. The fundamental issue was that the json object wrapped in the callback name does, in fact, need to be written to the Response. I'm an idiot. Anyway, it's working now. If others hit the same jquery -jsonp-wcfissue let me know. On Oct 10, 12:07 pm, tenaciousd [EMAIL PROTECTED] wrote: I'm using jQuery $.ajax to make a cross-domainjsonpcall to aWCF service. The call is working fine, entering the service endpoint, but the callback method never fires. I've tried many permutations of changes and can't seem to get this to work. TheWCFendpoint is returning a string (NOT doing a Response.Write) that contains a json object inside the callback wrapper (e.g. jsonp123( {Author:John Doe,Price:$35.90} ) ) and the content- type returned from the service is application/json; charset=utf-8. $.ajax call is below. Any help is much appreciated. var data = {ISBN : $(#isbn1).val()}; $.ajax({ type: GET, cache: false, url: http://localhost:63132/Widget.svc/GetProductInfo;, scriptCharset: utf-8, dataType: jsonp, data: data, success: function(data, textStatus){ alert(success);
[jQuery] Re: [validate] Time validation
You have to write a custom method: http://docs.jquery.com/Plugins/Validation/Validator/addMethod A date/time library like datejs may help: http://www.datejs.com/ Jörn On Fri, Oct 24, 2008 at 3:20 PM, Ravish [EMAIL PROTECTED] wrote: Hi, Is there anyway to do Time validation using the validator plugin? (http://bassistance.de/jquery-plugins/jquery-plugin-validation/) It seems to have date validation but not for time... Any other options?
[jQuery] Re: Ajax form submitting help
Thanx, would have been nice to know that i had to include a plugin to get it to work. but no im stuck. the text that is put in to the textarea has its html in entities format, so the char is lt; and same with know anyway to fix that? On Oct 24, 5:52 am, Mike Alsup [EMAIL PROTECTED] wrote: What i would like to accomplish is though Ajax submit the form, grab the text that is returned and put it in a textarea (that is already hidden on the page, and will be unhidden when the form submit) I cant seem to find how to do this. if someone could point me in the right direction that would be great. thanx. Use a 'success' handler to capture the response text and then set it as the value to your text area. Something like: $('#myForm').ajaxForm({ success: function(responseText) { $('#myTextarea').val(responseText).show(); } });
[jQuery] Re: jQuery Treeview 1.4 by Joern Zaefferer
Has anyone come across this before? This is the only thing from making this menu perfect in my opinion. Thanks, Brent On Oct 23, 4:29 pm, Cruizer [EMAIL PROTECTED] wrote: I am using this menu for a clients website, and I am having some problems with functionality. I may be reading it wrong, but in the documentation under persist: 'location' it states looks within all tree nodes with link anchors that match the document's current URL (location.href), and if found, expands that node (including its parent nodes). I am under the impression that when I create a URL for a menu item, when clicked it will expand the sub-menu's under that menu item, as well as directing you to the appropriate URL. This is where I am having the problem, it does not expand that menu item to expose the sub menu's when the menu item is a URL When you create the menu item as href=# it works fine, but obviously doesn't take you to the appropriate URL page. If the URL is href=something.html or href=something.php it doesn't work. It starts to expand the menu, then closes right up. To see an example of what I am speaking of, please go to the foloowing website. There click on services, then Engineering. Engineering will take you to a new page but the sub menu's won't show until you click one of the links on the engineering page itself. http://radtke.cgsart.com/v7.0/index.php I thought this might have been a problem related to Persist: location but when I removed that from the .js, the problem still existed. Thanks!
[jQuery] Re: Ajax form submitting help
Thanx, would have been nice to know that i had to include a plugin to get it to work. but no im stuck. the text that is put in to the textarea has its html in entities format, so the char is lt; and same with know anyway to fix that? Sorry, my brain saw the subject title Ajax form... and immediately thought ajaxForm(). Use decodeURIComponent to convert the text. Mike
[jQuery] Re: trying to get ajaxForm to use a dynamic class or id to prependTo
malsup wrote: success: function(responseText, status, $form) { var id = '#review_' + $form.attr(id); $(responseText).prependTo(id).effect(highlight, {}, 9000); } Mike HUZAH!!! So I was close! Ah, thank you. Four days later straight. But it's done in the proper jquery way! Sweet! Thank you :D -- View this message in context: http://www.nabble.com/trying-to-get-ajaxForm-to-use-a-dynamic-class-or-id-to-prependTo-tp20135944s27240p20152203.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: Having troubles accessing a variable in $.each
I figured out my problem was that I stuck // This function picks up the click and opens the corresponding info window function myclick(i) { GEvent.trigger(marker[i], click); } in the wrong part of the script.
[jQuery] Securing JSON data type
Right now (jquery 1.2.6), the httpData function does this with JSON data: // Get the JavaScript object, if JSON is used. if ( type == json ) data = eval(( + data + )); This is not very secure. It would be better to allow users to choose a JSON parser to use to parse the data into a json object. Now, I can easily override this method, but it is not listed as a public API method. I would prefer that, to prevent breaking myself, that this be split into a separate function: parseJSON: function (string) { return eval(( + data + )); } then document this method as part of the API. now someone can switch this method to use a JSON parser instead (there are several parsers out there and at least one already written as a jq plugin)
[jQuery] DW CS4 plugin?
Hi i was using an extension for jQuery with Dreamweaver CS3 from http://xtnd.us/, but with CS4 it makes all the syntax coloring purple and very hard to work on. Does anyone knows an alternative?
[jQuery] Re: jsonp to WCF problem
No problem. Probably I should've been a bit more explicit in reference to the setup. My WCF service is hosted in IIS 7, and the Stream and Callback classes I mentioned are in the same solution as the WCF endpoint. Also, you have to add a line to your web.config file to reference the IHttpHandler subclass (Callback class) so that WCF will recognize it. Further, even though I added that reference to my web.config IIS 7 STILL didn't recognize it. I had to explicitly add the module reference by way of IIS's Modules area. Now, it could be that this was a cache issue or something, and that IIS would've recognized my web.config entry at some point. I will likely refactor this and try to move the Stream and Callback classes to a separate assembly so that any future WCF services could use them again. I haven't tried this out yet but should work fine. Good luck. On Oct 24, 10:23 am, RWF [EMAIL PROTECTED] wrote: thanks tenacious for all the help. It sounds like i would just ditch my IIS hosted WCF service, i was under the impression from this link:http://msdn.microsoft.com/en-us/library/cc716898.aspx that it was some how possible to rig WCF to format the response natively but the solution it referrers to does not exist in the samples download. On Oct 24, 9:00 am, tenaciousd [EMAIL PROTECTED] wrote: Er, bugger should've been buffer. Quite a typo. On Oct 24, 9:58 am, tenaciousd [EMAIL PROTECTED] wrote: My service setup isn't exactly the same as yours but I think the same solution will work for you. You'll need to add two classes, one that inherits from Stream (we'll call is JsonStream) and another that inherits from the IHttpModule interface (we'll call this JsonModule). The JsonStream class will need a public property to store the name of the callback (e.g. CallbackFunctionName). JsonModule's Init needs to first look for all RequestType = GET and, for all such requests, do a GetValues on callback to see if the caller expects us to make a callback or simply return data. If a callback param is present we need to create a new instance of JsonStream passing the current context's Response.Filter to the constructor and then set CallbackFunctionName to the appropriate value. Then, in JsonStream in the overridden Write method, if CallbackFunctionName has a value you need to do something like (where _stream is the value passed into JsonStream's constructor): string content = CallbackFunctionName + ( + Encoding.UTF8.GetString(bugger) + );; _stream.Write(Encoding.UTF8.GetBytes(content), 0, content.Length); In this way you've decoupled the callback functionality from yourWCF service(s) but it just works for cases that require it. Hopefully this implementation will work in your scenario. On Oct 24, 9:22 am, RWF [EMAIL PROTECTED] wrote: Thanks for the info. How exactly are you writing directly to the response usingWCF? My IIS hostedWCFservice is basically just acting like a proxy to a windows hostedWCFservice, so they both use the same contract, but the IIS hosted service is a REST based service. Is there a way to maintain this uniformity of contracts, while writing directly to the response of the IIS service? On Oct 23, 8:22 am, tenaciousd [EMAIL PROTECTED] wrote: If you're going to do cross-domain calls you can't do a POST, only a GET. I think even if you specify POST as your type jQuery will convert it to a GET if your datatype isjsonp(check their doc but I'm pretty sure that's the case). As forWCFthe key is just making sure that you wrap your return in the callback method and write it to the Response. In other words, you can't simply have aWCFendpoint that returns a json-formatted object. Instead you need to write something like callbackMethodName( + yourJSONObject + ); to the Response. Once you've done this jQuery will execute the callback call, in which it will do an eval() on yourJSONObject and then call the success method, passing it the JSON object in the data parameter. At that point you will have dot notation on your JSON object. On Oct 22, 7:31 pm, RWF [EMAIL PROTECTED] wrote: I am usingWCFtoo, have you done projects that require an $.ajax POST request to aWCFservice cross site? If you have, how did come up with a server proxy to allow for cross site communication? On Oct 10, 2:01 pm, tenaciousd [EMAIL PROTECTED] wrote: Nevermind. The fundamental issue was that the json object wrapped in the callback name does, in fact, need to be written to the Response. I'm an idiot. Anyway, it's working now. If others hit the same jquery -jsonp-wcfissue let me know. On Oct 10, 12:07 pm, tenaciousd [EMAIL PROTECTED] wrote: I'm using jQuery $.ajax to make a cross-domainjsonpcall to aWCF service. The call is working fine,
[jQuery] li selection problem
I'm a newbee. I want to create a collapsable ul. But I want each visible li (including both parent li and child li's ) to alternate the background color. The problem is that when I apply the background to the parent, all of the child li's do not change color they inherit the parent color. I am using the following code to make this happen... html head script type=text/javascript src=jquery-1.2.6.js/script script type=text/javascript $(document).ready( function() { $('li.stripeable:even').addClass('greenbar'); }); /script style .greenbar { background-color:#EE; } ul { list-style-type: none; } .stripeable {} /style /head body ul li class=stripeable 1 (4 dates) ul li class=stripeable date1 /li li class=stripeable date2 /li li class=stripeable date3 /li li class=stripeable date4 /li /ul /li li class=stripeable 2 (3 dates) ul li class=stripeable date1 /li li class=stripeable date2 /li li class=stripeable date3 /li /ul /li li class=stripeable 3 (3 dates) ul li class=stripeable date1 /li li class=stripeable date2 /li li class=stripeable date3 /li /ul /li /ul /body /html
[jQuery] Re: Embedding HTML inside of XML, and writing it to a page
Hmmm, I haven't used XSL before, I'm looking it up right now, but I'm a bit unclear as to where to go from the point where I apply the XSLT to the XML. I mean, is this just automatically going to 'work'? On Oct 24, 7:19 am, Robert Koberg [EMAIL PROTECTED] wrote: On Oct 23, 2008, at 11:09 PM, Recoil wrote: Only thing is, I want the article text to be xhtml-enabled. so there's b's and br/'s and such in there, and we're looking at something more like article titleThis title is rad./title text And this is some bawesome/b article text.br/ It's HTML formatted though, ithat could pose a problem/i. /text /article I want to grab ALL of the text content inside of the text node, and just carte blanche throw it in the page. No, from what you say below you don't want the text, you want all the nodes: text, elements, etc. So.. how can I do that? .text() strips out all the html entities, .html() works what I can best describe as 'intermittently', and is unsupported for xml documents (only supported for html docs) what can i use to just tell js/jquery to find everything between text and /text, and stick it in the DOM as xhtml, tags included? The *best* way to handle this type of thing (if you are up for it) is to use XSL, which works in all browsers. You are looking for the a modified 'identity transform'. Basically, a modified identity transform allows you to recursively copy everything you do not override by a template match. An example XSL that does what you want: ?xml version=1.0 encoding=UTF-8? xsl:stylesheet xmlns:xsl=http://www.w3.org/1999/XSL/Transform; version=1.0 xsl:template match=/ xsl:apply-templates/ /xsl:template xsl:template match=article div class=article xmlns=http://www.w3.org/1999/xhtml; xsl:apply-templates/ /div /xsl:template xsl:template match=title h1 xmlns=http://www.w3.org/1999/xhtml; xsl:apply-templates/ /h1 /xsl:template xsl:template match=text xsl:apply-templates/ /xsl:template !-- Identity template: copies everything not overridden/matched in other templates -- xsl:template match=@*|node() xsl:copy xsl:apply-templates select=@*/ xsl:apply-templates/ /xsl:copy /xsl:template /xsl:stylesheet
[jQuery] Re: Image Display with Brightness Control?
Ouch. Looking further, I guess IE has filters that can handle some similar things to canvas (ie: lighten, but not change brightness, etc), but I'll attempt to find other solutions before we go that way (or just try to get them to find someone to do it in flash). Thanks muchly. josh On Thu, Oct 23, 2008 at 4:51 PM, ricardobeat [EMAIL PROTECTED] wrote: Those kind of effects are only possible in Firefox through the use of the canvas element, which IE doesn't support. The only cross-browser ways do to it currently would be using Flash or processing the image server-side and reloading it. On Oct 23, 2:56 pm, Josh Rosenthal [EMAIL PROTECTED] wrote: Hey Folks, So, a project involving allowing users to view scanned photos of historic structures has recently run into the problem that some of the photos are a bit dark relative to the originals, with some details being impossible to see in the jpg. When viewed on desktop, this is usually dealt with by users just tweaking the brightness in their quick and easy photo viewer of choice. I'm trying to replicate that functionality for a web interface we're developing. Does anyone know of an image control jquery plugin that allows brightness control, or has anyone dealt with similar issues? Optimally, it'd be something lightbox-esque, with FF3/IE7+ compatability, but I'd love to see any examples at all. Poking around, I've found a few potential leads if I have to try to build something, but I'm hoping someone out there has beaten me to it. In case anyone is curious, the leads I ran across were: FF Only:http://people.mozilla.com/~schrep/image12.html and:http://www.nihilogic.dk/labs/imagefx/ and lastly: processing.js seems to have similar capabilities, but I've never done anything with it and thus have no idea how easy/nightmarish it'd be to add a brightness slider or +/-10% button to an image. Also, compatibility is problematic. Thanks a lot, josh
[jQuery] Re: Embedding HTML inside of XML, and writing it to a page
Earlier I did a quick search for jQuery XSL plugin and found: http://johannburkard.de/blog/programming/javascript/xslt-js-version-3-0-released-xml-xslt-jquery-plugin.html I don't know if you are building the XML DOM or pulling it through ajax. I don't know if the above works out of the box with a prebuilt DOM (should be pretty easy to modify if it does not). But if you need to pull XML off the server, then the plugin looks pretty simple to use, e.g. $('#myid').xslt('bla.xml', 'bla.xslt'); best, -Rob On Oct 24, 2008, at 12:37 PM, Recoil wrote: Hmmm, I haven't used XSL before, I'm looking it up right now, but I'm a bit unclear as to where to go from the point where I apply the XSLT to the XML. I mean, is this just automatically going to 'work'? On Oct 24, 7:19 am, Robert Koberg [EMAIL PROTECTED] wrote: On Oct 23, 2008, at 11:09 PM, Recoil wrote: Only thing is, I want the article text to be xhtml-enabled. so there's b's and br/'s and such in there, and we're looking at something more like article titleThis title is rad./title text And this is some bawesome/b article text.br/ It's HTML formatted though, ithat could pose a problem/i. /text /article I want to grab ALL of the text content inside of the text node, and just carte blanche throw it in the page. No, from what you say below you don't want the text, you want all the nodes: text, elements, etc. So.. how can I do that? .text() strips out all the html entities, .html() works what I can best describe as 'intermittently', and is unsupported for xml documents (only supported for html docs) what can i use to just tell js/jquery to find everything between text and /text, and stick it in the DOM as xhtml, tags included? The *best* way to handle this type of thing (if you are up for it) is to use XSL, which works in all browsers. You are looking for the a modified 'identity transform'. Basically, a modified identity transform allows you to recursively copy everything you do not override by a template match. An example XSL that does what you want: ?xml version=1.0 encoding=UTF-8? xsl:stylesheet xmlns:xsl=http://www.w3.org/1999/XSL/Transform; version=1.0 xsl:template match=/ xsl:apply-templates/ /xsl:template xsl:template match=article div class=article xmlns=http://www.w3.org/1999/xhtml; xsl:apply-templates/ /div /xsl:template xsl:template match=title h1 xmlns=http://www.w3.org/1999/xhtml; xsl:apply-templates/ /h1 /xsl:template xsl:template match=text xsl:apply-templates/ /xsl:template !-- Identity template: copies everything not overridden/matched in other templates -- xsl:template match=@*|node() xsl:copy xsl:apply-templates select=@*/ xsl:apply-templates/ /xsl:copy /xsl:template /xsl:stylesheet
[jQuery] Re: Embedding HTML inside of XML, and writing it to a page
Shoot, you're talking about using xsl to generate the entire page, yes? On Oct 24, 11:37 am, Recoil [EMAIL PROTECTED] wrote: Hmmm, I haven't used XSL before, I'm looking it up right now, but I'm a bit unclear as to where to go from the point where I apply the XSLT to the XML. I mean, is this just automatically going to 'work'? On Oct 24, 7:19 am, Robert Koberg [EMAIL PROTECTED] wrote: On Oct 23, 2008, at 11:09 PM, Recoil wrote: Only thing is, I want the article text to be xhtml-enabled. so there's b's and br/'s and such in there, and we're looking at something more like article titleThis title is rad./title text And this is some bawesome/b article text.br/ It's HTML formatted though, ithat could pose a problem/i. /text /article I want to grab ALL of the text content inside of the text node, and just carte blanche throw it in the page. No, from what you say below you don't want the text, you want all the nodes: text, elements, etc. So.. how can I do that? .text() strips out all the html entities, .html() works what I can best describe as 'intermittently', and is unsupported for xml documents (only supported for html docs) what can i use to just tell js/jquery to find everything between text and /text, and stick it in the DOM as xhtml, tags included? The *best* way to handle this type of thing (if you are up for it) is to use XSL, which works in all browsers. You are looking for the a modified 'identity transform'. Basically, a modified identity transform allows you to recursively copy everything you do not override by a template match. An example XSL that does what you want: ?xml version=1.0 encoding=UTF-8? xsl:stylesheet xmlns:xsl=http://www.w3.org/1999/XSL/Transform; version=1.0 xsl:template match=/ xsl:apply-templates/ /xsl:template xsl:template match=article div class=article xmlns=http://www.w3.org/1999/xhtml; xsl:apply-templates/ /div /xsl:template xsl:template match=title h1 xmlns=http://www.w3.org/1999/xhtml; xsl:apply-templates/ /h1 /xsl:template xsl:template match=text xsl:apply-templates/ /xsl:template !-- Identity template: copies everything not overridden/matched in other templates -- xsl:template match=@*|node() xsl:copy xsl:apply-templates select=@*/ xsl:apply-templates/ /xsl:copy /xsl:template /xsl:stylesheet
[jQuery] Re: $(element).animate() shifts elements out of order while animating
The inline-block property is not yet well-supported cross-browser. Use display:block, float:left, you'll get the same results (and spot some flaws in your layout too). In case someone is reading this: I suppose all animations in jQuery give the elements a display:block property? Is inline-block support coming in 1.3? - ricardo On Oct 23, 9:18 pm, bulgarian388 [EMAIL PROTECTED] wrote: Hi guys, I'm new to jQuery and I need some help. I have a UL with LIs. In each LI there is a DIV with a bunch of content. The LIs are set to display inline. Anyway, when I run the animate function, the LIs get shifted into their default display (a list) and when the animation completes, the LIs return to their inline display. It's driving me crazy trying to figure it out, and I could definitely use some help. Here is the entire code: !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; html xmlns=http://www.w3.org/1999/xhtml; head script type=text/javascript src=jQuery.js/script script type=text/javascript var container; var lis; var axes = []; $(function () { container = $('#Container'); lis = $('li', container); axes = getAxes(); }); var getAxes = function (container) { var axes = []; for (var i = 0; i 600; (i = i + 100)) { var axis = { width: 100, left: i, right: (500 - i) }; axes.push(axis); }; return (axes); }; var Animate = function () { var h = document.getElementById('height'); var w = document.getElementById('width'); for (var i = 0; i lis.length; i++) { $(lis[i]).animate({ height: h.value + 'px', width: w.value + 'px' }, 1000); };}; /script style type=text/css * { margin: 0; outline: none; padding: 0; text-decoration: none; } body { margin: 64px; margin-left: auto; margin-right: auto; width: 600px; } #Container { border: 3px solid #FF; height: 180px; overflow: hidden; position: relative; } #Container ul { overflow: hidden; margin: 6px; position: absolute; white-space: nowrap; } #Container ul li { border: 3px solid #FF; display: inline-block; height: 160px; vertical-align: top; width: 146px; } #Container ul li div { overflow: hidden; padding: 6px; } #Control { list-style: none; padding: 32px;} /style /head body div id=Container ul li div h1Package 1/h1 hr / dl ddWebsite A/dd /dl a href=#Continue/a /div /li li div h1Package 2/h1 hr / dl ddWebsite A/dd ddWebsite B/dd /dl a href=#Continue/a /div /li li div h1Package 3/h1 hr / dl ddWebsite B/dd ddWebsite C/dd /dl a href=#Continue/a /div /li li div h1Package 4/h1 hr / dl ddWebsite A/dd ddWebsite C/dd /dl a href=#Continue/a /div /li li div h1Package 5/h1 hr / dl ddWebsite A/dd ddWebsite B/dd ddWebsite C/dd /dl a href=#Continue/a /div /li /ul /div ul id=Control li input type=text id=height / input type=text id=width / input type=button onclick=Animate(); value=Go / /li /ul /body
[jQuery] Re: Embedding HTML inside of XML, and writing it to a page
On Oct 24, 2008, at 12:59 PM, Recoil wrote: Shoot, you're talking about using xsl to generate the entire page, yes? No, you target an ID to put the transformed result into. On Oct 24, 11:37 am, Recoil [EMAIL PROTECTED] wrote: Hmmm, I haven't used XSL before, I'm looking it up right now, but I'm a bit unclear as to where to go from the point where I apply the XSLT to the XML. I mean, is this just automatically going to 'work'? On Oct 24, 7:19 am, Robert Koberg [EMAIL PROTECTED] wrote: On Oct 23, 2008, at 11:09 PM, Recoil wrote: Only thing is, I want the article text to be xhtml-enabled. so there's b's and br/'s and such in there, and we're looking at something more like article titleThis title is rad./title text And this is some bawesome/b article text.br/ It's HTML formatted though, ithat could pose a problem/i. /text /article I want to grab ALL of the text content inside of the text node, and just carte blanche throw it in the page. No, from what you say below you don't want the text, you want all the nodes: text, elements, etc. So.. how can I do that? .text() strips out all the html entities, .html() works what I can best describe as 'intermittently', and is unsupported for xml documents (only supported for html docs) what can i use to just tell js/jquery to find everything between text and /text, and stick it in the DOM as xhtml, tags included? The *best* way to handle this type of thing (if you are up for it) is to use XSL, which works in all browsers. You are looking for the a modified 'identity transform'. Basically, a modified identity transform allows you to recursively copy everything you do not override by a template match. An example XSL that does what you want: ?xml version=1.0 encoding=UTF-8? xsl:stylesheet xmlns:xsl=http://www.w3.org/1999/XSL/Transform; version=1.0 xsl:template match=/ xsl:apply-templates/ /xsl:template xsl:template match=article div class=article xmlns=http://www.w3.org/1999/xhtml; xsl:apply-templates/ /div /xsl:template xsl:template match=title h1 xmlns=http://www.w3.org/1999/xhtml; xsl:apply-templates/ /h1 /xsl:template xsl:template match=text xsl:apply-templates/ /xsl:template !-- Identity template: copies everything not overridden/ matched in other templates -- xsl:template match=@*|node() xsl:copy xsl:apply-templates select=@*/ xsl:apply-templates/ /xsl:copy /xsl:template /xsl:stylesheet
[jQuery] Re: jCarousel callbacks with custom data
Ok, I;m an idiot. It works the way I was asking, you just have to dereference your custom data off the options object of the jcarousel in the callback. Thusly, for posterity: // Init jcarousel jQuery('#mycarousel').jcarousel({ itemLoadCallback: {onBeforeAnimation: mycarousel_itemLoadCallback} arbitraryData: Custom data for everbody! }); // callback function mycarousel_itemLoadCallback(carousel, state) { alert(Here's our data: + carousel.options.arbitraryData); }
[jQuery] Re: li selection problem
Try $('ul ul li.stripeable:even').addClass('greenbar'); $('li.stripeable:even').addClass('greenbar'); Mauricio
[jQuery] Re: New to Jquery : Using it on dynmaically created divs
Using IDs with the solution I proposed above should work: function divShowHide(divID, imgID){ var $divToShow = $('#'+divID); var arrowURL = $divToShow.is(':visible') ? 'downarrow.gif'' : 'uparrow.gif''; // the above is the same as: if ($divToShow.is(':visible')) { arrow = 'downarrow.gif } else { arrow = 'uparrow.gif' }; $divToShow.slideToggle(slow); $('#'+imgID).attr('src',arrowURL); } On Oct 24, 8:50 am, James2008 [EMAIL PROTECTED] wrote: I've now got the divs sliding with this very simple code : function divShowHide(divID, imgID){ // Hides/Shows the vehicle details div and changes arrow appearance var divToChange = document.getElementById(divID); var arrowToChange = document.getElementById(imgID); $(divToChange).slideToggle(slow) } As you can see I still haven't got the arrows to work. I obviously need to toggle the src of the image as well as the slide movements for the div. How can I do this??? Thanks, James On Oct 24, 8:56 am, James2008 [EMAIL PROTECTED] wrote: Hi again, Jonathan - I have tried that function in replace of my own and it doesn't seem to work :-s Any ideas? Thanks, James On Oct 23, 9:30 pm, ricardobeat [EMAIL PROTECTED] wrote: A more resilient solution is to use class names instead, you can't just drop/ignore the IDs altogether: div class=titleProduct 8234/div (with background-image: url(downarrow.gif) on CSS) div class=descriptionbla bla bla bla/div $('div.title').click(function(){ var arrow = ( $(this).next('.description').is(':visible') ) ? 'url(downarrow.gif')' : 'url(uparrow.gif')'; $(this).css('backgroundImage',arrow); $(this).next('.description').slideToggle(); }); - ricardo On Oct 23, 1:31 pm, Jonathan Sharp, Out West Media jquery- [EMAIL PROTECTED] wrote: Hi James, Here's one way to rewrite it using jQuery: function divShowHide(divID, imgID) { var d = $('#' + divID).toggle(); $('#' + imageID).attr('src', 'Images/' + ( d.is(':visible') ? 'down' : 'up' ) + 'arrow.png' ); } Cheers, -Jonathan On Oct 23, 2008, at 8:42 AM, James2008 wrote: Hi. At the moment I've creating 2 divs for each record in a database. One to first give a title for that piece of information and the second to be a show/hide div that gives furthur information upon clicking a little arrow. I generate both divs server side on an updatepanel refresh. I have them showing/hiding at the moment using this function... function divShowHide(divID, imgID){ // Hides/Shows the second div and changes arrow appearance var divToChange = document.getElementById(divID); if(divToChange.style.display == block) { divToChange.style.display = none; document.getElementById(imgID).src = Images/downarrow.png; } else { divToChange.style.display = block; document.getElementById(imgID).src = Images/uparrow.png; } } I was wandering if I could incorporate Jquery into this function to make it do the job , or if all the divs have to be created in the head section with jquery beforehand?? I have tried using the show/hide commands in the above function using Jquery but they don't seem to work. Each of my second divs have a unique ID, I just need to know if it's possible to do it in this way?? All the examples on the site use pre-defined names for divs but as I do not know the ammount of div sets before so can't do that. They are all called div2 + a unique identifyier. Any help would be greatly appreciated. Thanks, James
[jQuery] Re: jQuery.getScript problems on IE 7
So.. get this example http://rapidshare.com/files/157173826/getscripterro.zip.html Download that e open getscripterro.htm in IE 6+, you will see error. And you try in FF it's will work fine. About what you told me about inline scripts I really need get protoculous-effects-shrinkvars.js file via getScript(), becouse its is a AJAX window modal. Thanks for help. On 23 out, 22:37, Karl Rudd [EMAIL PROTECTED] wrote: Without seeing a live example page it is very hard to know what could be going wrong. My advice would be to try not to load the protoculous-effects-shrinkvars.js file via getScript(). Just include it as you would any other JavaScript file. Karl Rudd On Fri, Oct 24, 2008 at 4:19 AM, Alexsandro_xpt [EMAIL PROTECTED] wrote: Yes, I already use noConflict() function. I don't have any conflict, I just said the jQuery.getScript can't eval protoculous-effects-shrinkvars.js causing error in script. Can you help me please? On 22 out, 20:15, Karl Rudd [EMAIL PROTECTED] wrote: Have followed the advice athttp://docs.jquery.com/Using_jQuery_with_Other_Libraries? Karl Rudd On Wed, Oct 22, 2008 at 11:01 PM, Alexsandro_xpt [EMAIL PROTECTED] wrote: Nobody know what happen with .getScript getting prototype framework? On 22 out, 00:57, Alexsandro_xpt [EMAIL PROTECTED] wrote: My IE 7 and 6 get a error while load protoculous-effects-shrinkvars.js by jQuery.getScript method. IE popup this error message: Line: 310750026 Char: 72353 Error: 'null' is null or not an object Code: 0 How to fix it using jQuery.getScript? Prototype Framework doesn't like jQuery? PS.: In FF work very well.
[jQuery] on the jQuery XSL plugin: xslt.js
Hi, On http://johannburkard.de/software/xsltjs/ -- very nice and useful! I was just looking at the source of this and want to offer a few suggestions: * ability to 'get' the compiled XSL so you can store in some cache for reuse without going through the download/parse again. The most expensive part of a transformation (other than downloading the xsl file) is parsing it into a compiled instance. If you use it more than once you should not have to download/parse again. * ability to add parameters. In the case of a cached stylesheet you also need the ability to remove parameters since they will stay in the compiled xsl unless removed leading to unexpected results. * (lesser) the ability to 'get' the XML source. A good way to increase performance for any kind of XSL transformation is to use a small XML document (x/) for the main source of a transform. Then use the document function to pull in any other XML needed. This bypasses larger XML DOM creation in JS and leaves it to the XSL processor which can then create a processor optimized DOM which is usually much smaller (usually like a list of sax events). The processor would do this regardless when given an XML DOM as the main source of the transform. best, -Rob
[jQuery] Validate. Not working with Radio input
Hello, I am trying to validate a form with radio inputs. I want to the form to be submitted only if an option was selected: form action=/Poll/Vote/1 class=Poll id=Poll method=post fieldset label for=OptionsArrayDo you like to travel?/label input type=radio name=OptionsArray id=1 value=1 class=Radio / label for=1Yes/label input type=radio name=OptionsArray id=2 value=2 class=Radio / label for=2No/label input id=Submit name=Submit type=submit value=Vote / /fieldset /form I used: $(#Poll).each(function() { $(this).validate({ errorClass: Error, errorElement: label, rules: { OptionsArray: { required: true } }, messages: { OptionsArray: { required: You didn't choose your vote } } }); }); The form is submitted even if I don't choose an option! If I select an option I get an error on Firebug: validator.settings[on + even... + event.type].call(validator, this[0]); Could someone tell me what am I doing wrong? Thank you, Miguel
[jQuery] Multiple File Upload, help editing images
Hi everyone, I'm making a product manager for a CMS i'm working on. 'till now I made the Multiple File Upload plugin work perfecly, uploading pictures of the new products, on the new product form. But now I need to make the edition of the product, and need that all the images uploaded appear on a list on the edit product form, so I can remove the ones i've uploaded before or add other images on the same product. All the images uploaded are stored on an array on the DB, and i need to easly edit it with ajax, using the Multiple File Upload plugin. Anyone can help me on this? Thanks in advance. Gabriel Roloff
[jQuery] putting jquery inline
When I include jquery inline in the body via a script tag I'm getting jquery not defined errors. Is there a reason why this approach can't work, or does it sounds like I'm doing something else wrong? The only reason I'm doing this is because it's a requirement on the opensocial container surface I'm developing on. Chris
[jQuery] select width shrinked after appending new option
Hi, The problem is simple. I just want to add option to select, but the size of select shrinks. This happens in IE7. Works fine in FF3. I couldn't find any post about this problem. Maybe I was doing something wrong. Can anyone help? Thanks! Below is the simple html I used to test. test source--- html head style type=text/css select { width:100%; } /style script type=text/javascript src=../script/jquery-1.2.6.min.js/ script script type=text/javascript $(function() { alert(); $('select').append(option100/option); }); /script /head body table border=1 width=100% tr tdselect/select/td /tr /table /body /html test source---
[jQuery] Using ajaxStart/Stop for multiple ajax calls
It's possible that I could have 2+ ajax actions running on my website at the same time, and I'd like to show a 'loading' image for each of them. When I use ajaxStart/Stop, if one ajax call starts, it shows the 'loading' image, but if that call doesn't stop before another ajax call starts, the second call does not show the 'loading' image. Is there anyway around this? Thanks!
[jQuery] Re: putting jquery inline
You're going to have to be more specific. Test page? Example code? You can certainly load jQuery in a script tag in the body. I do it all the time in my Google mapplets and gadgets; it works fine. But I wouldn't be able to guess what might have gone wrong without seeing the code. -Mike From: snacktime When I include jquery inline in the body via a script tag I'm getting jquery not defined errors. Is there a reason why this approach can't work, or does it sounds like I'm doing something else wrong? The only reason I'm doing this is because it's a requirement on the opensocial container surface I'm developing on.
[jQuery] Re: li selection problem
With... $('ul ul li.stripeable:even').addClass('greenbar'); it only stripes the child li's not the parent li's also. I want every line in the display to be striped in sequential order. Marty
[jQuery] Re: jQuery Documentation in PDF
No! do whatever you want with the code. It's just a first version. I would make new versions based on comments. On 22 oct, 16:27, Wint [EMAIL PROTECTED] wrote: Do you mind if we modify the code at all Jonatan? I wouldn't mind taking what you have here and running with it. Either way, this is very cool indeed, thanks a bunch! On Oct 21, 1:22 pm, Isaak Malik [EMAIL PROTECTED] wrote: Hey Jonatan, This is EXTREMELY useful and I'm sure more think the same way, this solves the problems most are having with the documentation page. Thanks a bunch :-)! On Tue, Oct 21, 2008 at 1:45 PM, Jonatan [EMAIL PROTECTED] wrote: Hi: I made a program for create a PDF of the jQuery and jQueryUI from the xml. There's also the source code of the program (made in VS2005/C#). I hope someone find the docs in PDF usefull as me :) You can download from: Docs in pdf: http://www.puntoequis.com.ar/aktive/soft/jQueryDocumentation.7z Program to create: http://www.puntoequis.com.ar/aktive/soft/jQueryDocs-Creator.7z I will post updates in my page (in spanish) http://www.puntoequis.com.ar/npx/default.aspx?VIEWENTRY050057 Jonatan -- Isaak Malik Web Developer- Ocultar texto de la cita - - Mostrar texto de la cita -
[jQuery] Re: li selection problem
come on marty try reviewing your css skills a little bit especially the css selectors. You 've got it wrong, but this should do : $('ul li.stripeable:even').addClass('greenbar'); On Fri, Oct 24, 2008 at 8:47 PM, MartyB [EMAIL PROTECTED] wrote: With... $('ul ul li.stripeable:even').addClass('greenbar'); it only stripes the child li's not the parent li's also. I want every line in the display to be striped in sequential order. Marty
[jQuery] Re: li selection problem
The parent li color is showing through... put .stripeable { background-color: #FFF } in there to see what I mean On Oct 24, 2:24 pm, MartyB [EMAIL PROTECTED] wrote: I'm a newbee. I want to create a collapsable ul. But I want each visible li (including both parent li and child li's ) to alternate the background color. The problem is that when I apply the background to the parent, all of the child li's do not change color they inherit the parent color. I am using the following code to make this happen... html head script type=text/javascript src=jquery-1.2.6.js/script script type=text/javascript $(document).ready( function() { $('li.stripeable:even').addClass('greenbar');}); /script style .greenbar { background-color:#EE;} ul { list-style-type: none;} .stripeable {} /style /head body ul li class=stripeable 1 (4 dates) ul li class=stripeable date1 /li li class=stripeable date2 /li li class=stripeable date3 /li li class=stripeable date4 /li /ul /li li class=stripeable 2 (3 dates) ul li class=stripeable date1 /li li class=stripeable date2 /li li class=stripeable date3 /li /ul /li li class=stripeable 3 (3 dates) ul li class=stripeable date1 /li li class=stripeable date2 /li li class=stripeable date3 /li /ul /li /ul /body /html
[jQuery] Re: jQuery Uploader Flash player 10 fix
Another update: - Started working on the demo's; squatting some final bugs and then all i have to do is rebuild the demo's. - Luckily i've documented the JavaScript extensivly so documentation will be quick. -- Gilles On Oct 22, 8:28 pm, Gilles (Webunity) [EMAIL PROTECTED] wrote: Yes that will be possible with my new version and is default implemented. I shall see if i can make a demo for that. On 21 okt, 22:59, Alexandre Plennevaux [EMAIL PROTECTED] wrote: hi Gilles, i was about to take the same path: convert YUIuploaderinto jquery for the new version of jquploader, because it's simply the best implementation i've seen so far (kuddos to yahoo). i'll be very interested with what you come up with. There is one issue i still lack for a good answer, i'd be interested in your opinion: say you want to control the uploaded file 's name, for example so that it does not erase an existing file with the same name: then the serverside script woudl produce a unique file name, according to a given logic (timestamp appended, etc), or simply to avoid empty spaces or quote characters in the name. Is it actually possible that the flash file returns the serverside-generated file name ? thanks, Alexandre On Tue, Oct 21, 2008 at 8:55 PM, Gilles (Webunity) [EMAIL PROTECTED]wrote: Update: Most of the callbacks have been implemented; Actionscript (Flash) work seems to be done; yet i did all my work without debugging. Tomorrow i have to add maybe 3 or 4 events / log messages and then i can start building ;) -- Gilles On Oct 20, 7:52 pm, Gilles (Webunity) [EMAIL PROTECTED] wrote: Guys; A lot (8) people have allready asked me if i was going to fix the mess Adobe made and my answer is yes, i am working on it. This post is to assure you that the jQuery Flash baseduploaderi wrote in 2006 has been revived. The project will no longer be based on swfupload, since i added way to much code of my own into it. The new version is (looseley) based upon YUIuploadercomponent, and off course i've taken a peek to see what FancyUpload does in their code. To be honest; they are both very good products and both have their pro's and con's. I am hoping to create a project which will be the best of both worlds and more (currently, approx. 80% code is my own work) I've allready put about 10 hours of work in the new jQuery upload plugin (which was originally hosted onhttp://uploader.webunity.nl/) but unfortunately it is not finished yet. Since i based the startcode (e.g. how to create an AS3 movieclip) on YUI, I must abide by their license, which is BSD. Theuploaderplugin (Javascript) is going to be included as full source, but the Actionscript file is going to be precompiled. This is due to the fact that i simply put to much work in it. Some stuff that i added; - A lot more and consistant event handlers - A lot more and better logging - Multiple simultanous (!!) uploads And, ported from my old version: - Queue managemen - Max file size - Max queue size - Max queue count The idea is to even make it possible to add files while you are allready uploading; sort of background file transfer so to say. Anyway; i'll hope to finish the Actionscript code tomorrow evening (it is now 20:00 here) and the demo's the day after that. Basically; by the end of the week you should have some working examples. Thank you for al your wonderfull feedback -- Gilleshttp://www.webunity.nl/-Tekst uit oorspronkelijk bericht niet weergeven - - Tekst uit oorspronkelijk bericht weergeven -
[jQuery] Re: li selection problem
Alexandre, Your solution yields the same results as the original problem. How is ul li different from li since li cant exist without a parent ul, thus ul is redundant and unnecessary? The more I am studying this, the more I am convinced that what I am trying to do is impossible. It is impossible to disassociate a child li background-color from the parent's, and still let jQuery apply the :even filter to all li's, sequencially for both parent and child. On Oct 24, 2:35 pm, Alexandre Plennevaux [EMAIL PROTECTED] wrote: come on marty try reviewing your css skills a little bit especially the css selectors. You 've got it wrong, but this should do : $('ul li.stripeable:even').addClass('greenbar'); On Fri, Oct 24, 2008 at 8:47 PM, MartyB [EMAIL PROTECTED] wrote: With... $('ul ul li.stripeable:even').addClass('greenbar'); it only stripes the child li's not the parent li's also. I want every line in the display to be striped in sequential order. Marty- Hide quoted text - - Show quoted text -
[jQuery] Re: li selection problem
Suggestion: Forget jQuery for a while. Instead, hand-edit an HTML file and see if you can get the styling the way you want. That way you don't have to troubleshoot both sides at once. All you have to worry about is the HTML and CSS. If you can get that to work, then you can duplicate the effect with jQuery. -Mike From: MartyB The more I am studying this, the more I am convinced that what I am trying to do is impossible. It is impossible to disassociate a child li background-color from the parent's, and still let jQuery apply the :even filter to all li's, sequencially for both parent and child.
[jQuery] Re: li selection problem
Yup I second Mike's advise. Make sure first that CSS allows it in a static demo file, then when you get it to work, you'll know what to script exactly. Just a remark $('ul ul li') is not the same as $('ul li'). In the first case it would only concern li which are inside an ul, inside another ul (so, excluding first-level ul). Second case concerns all LI elements. On Fri, Oct 24, 2008 at 10:11 PM, Michael Geary [EMAIL PROTECTED] wrote: Suggestion: Forget jQuery for a while. Instead, hand-edit an HTML file and see if you can get the styling the way you want. That way you don't have to troubleshoot both sides at once. All you have to worry about is the HTML and CSS. If you can get that to work, then you can duplicate the effect with jQuery. -Mike From: MartyB The more I am studying this, the more I am convinced that what I am trying to do is impossible. It is impossible to disassociate a child li background-color from the parent's, and still let jQuery apply the :even filter to all li's, sequencially for both parent and child.
[jQuery] Re: xml find element with this attribute value
On Oct 24, 2008, at 7:09 AM, Robert Koberg wrote: On Oct 24, 2008, at 2:35 AM, akel wrote: i've been reading a lot and still does not find any solution to my query. please find the details below. list sample name=a id=1/ sample name=b id=2/ /list in jquery how can i automatically find the element sample with attribute name equals to a without looping entirely the xml jQuery supports a kind of XPath syntax, so: $(/list/[EMAIL PROTECTED]'a']) The / is no longer available and the @ is deprecated. There is a basic xpath plugin available if you still want to use these selectors: http://plugins.jquery.com/project/xpath --Karl
[jQuery] Re: Cycle actions that happen faster than the javascript transitions
http://monsterpocalypsegame.com/ With that front news box, you can mouseover the itemss faster than they can transition sometimes, so you are left hovering an item that isn't the one you're looking at. On Oct 23, 10:48 am, Mike Alsup [EMAIL PROTECTED] wrote: Can you give me an example of that scenario? Thanks. On Oct 13, 4:50 pm,sorahn[EMAIL PROTECTED] wrote: For actions that happen faster than the javascript transitions, is there a way to make the javascript break it's current loop, and start doing the new action?
[jQuery] Validate. Password Bug?
Hello, I am validating a password field as follows: $.validator.addMethod('password', function (value, element) { return this.optional(element) || /^([a-zA-Z0-9]{8,24}) $/.test(value); }, 'Use 8 to 24 letters or numbers only'); I write 8 numbers and letters. The message disappears. Fine ... Then I write a few spaces and the message do not fire even when I submit the form. Then I write a few letters or numbers after the empty spaces and the message fires again ... Is this a bug? Thanks, Miguel
[jQuery] [OT] please check website before launch
Hi mates, May i ask you guys to have a look at my latest project,a bit on the experimental side in terms of UI : a barcode image gallery for a spanish photographer: http://www.pixeline.be/test/lisapram/ Let me know of any bugs you find? AFAIK everything should run smooth (except for the long loading time). Please indicate your OS platform, browser and hardware specs. The initial load time is quite long so stick around please... Looking forward to your feedback! Thanks a lot, Alexandre
[jQuery] Re: putting jquery inline
Not to state the obvious, but did you make sure that the path to the jquery is correct? Trey On Oct 25, 4:39 am, snacktime [EMAIL PROTECTED] wrote: When I include jquery inline in the body via a script tag I'm getting jquery not defined errors. Is there a reason why this approach can't work, or does it sounds like I'm doing something else wrong? The only reason I'm doing this is because it's a requirement on the opensocial container surface I'm developing on. Chris
[jQuery] jQuery Tweets
I forgot who is running jQuery Twitter feed so I'll just ask here. How do you handle it? Do people send you tips on new websites using jQuery and new plugins? -- Mika Tuupola http://www.appelsiini.net/
[jQuery] Hover with a fade question (n00b)
Hi, I'm new to this group and to jQuery and javascript in general. I would like to learn how to use hover with a fade. I can do each separately but am having a hard time chaining them. Here's my best attempts at a simple hover button with a fadeIn and FadeOut: $(document).ready(function() { $('.button').hover(function() { $(this).fadeIn(1000,$('.button').addClass('hover')); }, function() { $(this).fadeOut(1000,$('.button').removeClass('hover')); }); }); That didn't work. Nor did this: $(document).ready(function() { $('.button').hover(function() { $(this).addClass('hover').fadeIn(1000); }, function() { $(this).removeClass('hover'.fadeOut(1000)); }); }); If anybody can help me out I'd be stoked. I've spent too much time on this seemingly simple effect. Thanks.
[jQuery] [tooltip]
Hello, I am using jquery.tooltip.js to add tooltips to select options. The problem that occurs is that the tooltip doesn't appear relative to the mouse. I have tried a number of top and left settings, but have not had any luck. $('selector')tooltip({ bodyHandler: function(){ var _data = this.tooltipText.split(';'); alert var _h3 = _data[0]; var _body = _data[1].split('|'); var _out = 'h3' + _h3 + '/h3ul'; for (_i = 0; _i _body.length; _i++) { _out += 'li' + _body[_i] + '/li'; } _out += '/ul'; return _out; }, left: 50 }); Thanks, Aaron
[jQuery] Missing the previous jQuery site visual style?
Hi everyone. I miss the previous visual design of the jQuery site... I was away for a few months and when I got back it looked like it had stepped a couple of years backward and taken on a very Rails-in-the- early-days look with that Trebuchet font and big empty sidebars... No offense intended to its current designer, but I really loved the openness, readability, and space efficiency of the older version. Temporary solution for those who share my dismay: this guy CSS'd up a nearly complete fix -- if you're using Firefox you can get this almost instantly here: http://userstyles.org/styles/11536 He pretty much put it right back in the earlier style, much more readable, and adds nothing to the load time since it's client-side CSS on a tiny, tiny FF plugin. Check it out! (and to John and the site's maintainers... any chance we might see a rollback of this weird move?)
[jQuery] Re: Change Event Firing Twice
I'm encountering a similar situation. Have you found the answer yet? Thanks in advance for any info.
[jQuery] Re: mixing jQuery with regular JavaScript
On Fri, Oct 24, 2008 at 2:25 PM, Eric P [EMAIL PROTECTED] wrote: Hi, I'm trying to mix jQuery with some pre-existing JavaScript/HTML, but I'm having what appears to be scope issues. The code I'm working on already has a bunch of inline event handler function calls in the HTML tags, and it'd be a ton of work to change them all to the unobtrusive way via jQuery. Now when I wrap all the pre-existing function definitions into the jQuery document instance (i.e., $(function(){ ... }), I'm able to slip in some jQuery. However, all the function definitions are now no longer available to the inline event handler calls. Here's a simple demonstration. In this example the test() function is not available when the div. script $(function(){ function test(){ console.log('hi')} }); /script div onclick=test() style=background-color:red; width:300pxhi /div Opps... small typo. In this example the test() function is not available when the div ...is clicked.
[jQuery] mixing jQuery with regular JavaScript
Hi, I'm trying to mix jQuery with some pre-existing JavaScript/HTML, but I'm having what appears to be scope issues. The code I'm working on already has a bunch of inline event handler function calls in the HTML tags, and it'd be a ton of work to change them all to the unobtrusive way via jQuery. Now when I wrap all the pre-existing function definitions into the jQuery document instance (i.e., $(function(){ ... }), I'm able to slip in some jQuery. However, all the function definitions are now no longer available to the inline event handler calls. Here's a simple demonstration. In this example the test() function is not available when the div. script $(function(){ function test(){ console.log('hi')} }); /script div onclick=test() style=background-color:red; width:300pxhi /div Any ideas? I'm assuming many others have run into this predicament. Thanks for reading, Eric P.
[jQuery] Re: jQuery.ajax How to send an xml document as data to the server
In case anyone else runs into this, I had to add the type and contentType properties before this would work. EC $.ajax({ url: page.php , type: POST , contentType: text/xml , processData: false , data: xmlDocument , success: handleResponse }); On Sep 2, 4:42 am, JUN [EMAIL PROTECTED] wrote: in the jQuery documentation: Sends an xml document as data to the server. By setting the processData option to false, the automatic conversion of data to strings is prevented. var xmlDocument = [create xml document]; $.ajax({ url: page.php, processData: false, data: xmlDocument, success: handleResponse }); but, i never use this code works... anyone who can give me the works code?
[jQuery] Re: Using ajaxStart/Stop for multiple ajax calls
It's possible that I could have 2+ ajax actions running on my website at the same time, and I'd like to show a 'loading' image for each of them. When I use ajaxStart/Stop, if one ajax call starts, it shows the 'loading' image, but if that call doesn't stop before another ajax call starts, the second call does not show the 'loading' image. Is there anyway around this? Thanks! That's how ajaxStart and ajaxStop are supposed to work. If you want to handle calls individually then you can use ajaxSend and ajaxComplete. Mike
[jQuery] Re: Cycle actions that happen faster than the javascript transitions
http://monsterpocalypsegame.com/ With that front news box, you can mouseover the itemss faster than they can transition sometimes, so you are left hovering an item that isn't the one you're looking at. Oh, I see what you mean now. Try the 'fastOnEvent' option. $('#whatever').cycle({ fastOnEvent: true, // other options });
[jQuery] Re: How to call a function directly that is normally an event.. ?
Let's say you have this: $('#myID').click(magicFunc); magicFunc looks like: function magicFunc() { $(this).fadeOut(); } Now, let's say I want to invoke magicFunc on a certain item MANUALLY, via code, not through a user-driven event. e.g.: (I know this is wrong) $('#myID').magicFunc(); I don't want to make a plug-in. I just want to somehow make the $ (this) reference in magicFunc() refer to whatever I pass into it. Is that possible? $('#myID').triggerHandler('click');
[jQuery] Re: mixing jQuery with regular JavaScript
I'm trying to mix jQuery with some pre-existing JavaScript/HTML, but I'm having what appears to be scope issues. The code I'm working on already has a bunch of inline event handler function calls in the HTML tags, and it'd be a ton of work to change them all to the unobtrusive way via jQuery. Now when I wrap all the pre-existing function definitions into the jQuery document instance (i.e., $(function(){ ... }), I'm able to slip in some jQuery. However, all the function definitions are now no longer available to the inline event handler calls. Here's a simple demonstration. In this example the test() function is not available when the div. script $(function(){ function test(){ console.log('hi')}}); /script div onclick=test() style=background-color:red; width:300pxhi /div Any ideas? I'm assuming many others have run into this predicament. Thanks for reading, Eric P. Don't put those function definitions inside your private scope. You need them to be global in order for the inline handlers to work. script function test(){ console.log('hi')}}); $(function(){ // put code here that needs to run when DOM is loaded }); /script
[jQuery] How to call a function directly that is normally an event.. ?
Sorry, I don't know how to summarize this problem so I'll just post code. Let's say you have this: $('#myID').click(magicFunc); magicFunc looks like: function magicFunc() { $(this).fadeOut(); } Now, let's say I want to invoke magicFunc on a certain item MANUALLY, via code, not through a user-driven event. e.g.: (I know this is wrong) $('#myID').magicFunc(); I don't want to make a plug-in. I just want to somehow make the $ (this) reference in magicFunc() refer to whatever I pass into it. Is that possible?
[jQuery] Re: Change Event Firing Twice
Does ticking one untick another? That would trigger a change event on the one being ticked as well as the one being unticked. On Sep 22, 5:26 pm, sobencha [EMAIL PROTECTED] wrote: My problem is that I seem to be having a change even firing twice. Here are the details I have several checkboxes (input type=checkbox) all containing a class named metaABOCode. Whenever one is ticked or unticked (hence the change event), I want to grab some data via a json ajax call to populate some content. Everything works brilliantly, except for the fact that it seems as though the code below is being called twice (resulting in two ajax calls, etc.). Any ideas/suggestions as to why this is happening? Feel free to let me know if anything else is of glaringly poor form as well! Thanks a lot; appreciate any help you might be able to provide. The code (and using 1.2.6)... $('.metaABOCode').change(function() { $('#metaDistributorCodeTable tr.metaDynamic').remove(); if (!$(this).is(':checked')) { $('#meta_abocode_all').removeAttr('checked'); } else if ($('.metaABOCode:checked').size() == $ ('.metaABOCode').size()-1) { $('#meta_abocode_all').attr('checked','true'); } var str = ''; $('input.metaABOCode:checked').each(function() { if ($(this).attr('id').substring(13) != 'all') { str += $(this).attr('id').substring(13) + -; } }); jQuery.getJSON('/cms/page/meta/distributorcode/' + str, function(json) { var html = ''; html += 'tr class=metaDynamic'; html += 'tdinput id=meta_distributor_all class=metaDistributorCode clickable type=checkbox //td'; html += 'tdspan style=font-weight:bold;Select All/span/ td'; html += '/tr'; for (var i=0; ijson.length; i++) { html += 'tr class=metaDynamic'; html += 'tdinput id=meta_distributorcode_' + json[i] ['sp_code'] + ' class=metaDistributorCode clickable type=checkbox //td'; html += 'td' + json[i]['sp_name'] + '/td'; html += '/tr'; } $('#metaDistributorCodeTable').append(html); }); });
[jQuery] Re: Using ajaxStart/Stop for multiple ajax calls
And If I want handle to catch AjaxError in ajaxComplete? Exist a way? On 25 out, 00:01, Mike Alsup [EMAIL PROTECTED] wrote: It's possible that I could have 2+ ajax actions running on my website at the same time, and I'd like to show a 'loading' image for each of them. When I use ajaxStart/Stop, if one ajax call starts, it shows the 'loading' image, but if that call doesn't stop before another ajax call starts, the second call does not show the 'loading' image. Is there anyway around this? Thanks! That's how ajaxStart and ajaxStop are supposed to work. If you want to handle calls individually then you can use ajaxSend and ajaxComplete. Mike
[jQuery] Re: mixing jQuery with regular JavaScript
Alternatively, script $(function(){ window.test = function(){ console.log('hi')} }); /script On Oct 24, 10:11 pm, Mike Alsup [EMAIL PROTECTED] wrote: I'm trying to mix jQuery with some pre-existing JavaScript/HTML, but I'm having what appears to be scope issues. The code I'm working on already has a bunch of inline event handler function calls in the HTML tags, and it'd be a ton of work to change them all to the unobtrusive way via jQuery. Now when I wrap all the pre-existing function definitions into the jQuery document instance (i.e., $(function(){ ... }), I'm able to slip in some jQuery. However, all the function definitions are now no longer available to the inline event handler calls. Here's a simple demonstration. In this example the test() function is not available when the div. script $(function(){ function test(){ console.log('hi')}}); /script div onclick=test() style=background-color:red; width:300pxhi /div Any ideas? I'm assuming many others have run into this predicament. Thanks for reading, Eric P. Don't put those function definitions inside your private scope. You need them to be global in order for the inline handlers to work. script function test(){ console.log('hi')}}); $(function(){ // put code here that needs to run when DOM is loaded}); /script
[jQuery] Re: Hover with a fade question (n00b)
$(document).ready(function() { $('.button').hover(function() { $(this).addClass('hover').fadeIn(); }, function() { $(this).removeClass('hover').fadeOut(); }); }); This should work, it's exactly the same as your second try but with correct syntax. On Oct 24, 11:54 pm, gerbert [EMAIL PROTECTED] wrote: Hi, I'm new to this group and to jQuery and javascript in general. I would like to learn how to use hover with a fade. I can do each separately but am having a hard time chaining them. Here's my best attempts at a simple hover button with a fadeIn and FadeOut: $(document).ready(function() { $('.button').hover(function() { $(this).fadeIn(1000,$('.button').addClass('hover')); }, function() { $(this).fadeOut(1000,$('.button').removeClass('hover')); }); }); That didn't work. Nor did this: $(document).ready(function() { $('.button').hover(function() { $(this).addClass('hover').fadeIn(1000); }, function() { $(this).removeClass('hover'.fadeOut(1000)); }); }); If anybody can help me out I'd be stoked. I've spent too much time on this seemingly simple effect. Thanks.
[jQuery] Re: More efficient animation for multiple elements
Maybe you could post a working sample to jsbin.com, that would make things a lot easier. On Oct 24, 4:00 pm, c.barr [EMAIL PROTECTED] wrote: Hate to bump this, but it might get lost otherwise!
[jQuery] Re: event.preventDefault() seems to fail
I'm sorry, but I'm not following you. Can you further explain what you mean? Thanks On Oct 24, 12:36 am, Prajwala Manchikatla [EMAIL PROTECTED] wrote: You can think of stopPropagation.http://www.w3.org/TR/DOM-Level-3-Events/events.html#Events-flow I hope this might help you.
[jQuery] Re: Hover with a fade question (n00b)
Thank you for cleaning that up, but it's still not quite right. It's not fading in, it just adds the class instantly. and when it fades out, it removes the div I put the .hover class on. Thanks for trying. On Oct 24, 8:03 pm, ricardobeat [EMAIL PROTECTED] wrote: $(document).ready(function() { $('.button').hover(function() { $(this).addClass('hover').fadeIn(); }, function() { $(this).removeClass('hover').fadeOut(); }); }); This should work, it's exactly the same as your second try but with correct syntax. On Oct 24, 11:54 pm, gerbert [EMAIL PROTECTED] wrote: Hi, I'm new to this group and to jQuery and javascript in general. I would like to learn how to use hover with a fade. I can do each separately but am having a hard time chaining them. Here's my best attempts at a simple hover button with a fadeIn and FadeOut: $(document).ready(function() { $('.button').hover(function() { $(this).fadeIn(1000,$('.button').addClass('hover')); }, function() { $(this).fadeOut(1000,$('.button').removeClass('hover')); }); }); That didn't work. Nor did this: $(document).ready(function() { $('.button').hover(function() { $(this).addClass('hover').fadeIn(1000); }, function() { $(this).removeClass('hover'.fadeOut(1000)); }); }); If anybody can help me out I'd be stoked. I've spent too much time on this seemingly simple effect. Thanks.
[jQuery] Re: jQuery Tweets
Hi Mika, Rey runs it and I occasionally post something to it. We find jQuery- related stuff through RSS readers and from tips. As for new websites using jQuery, Rey split off that kind of announcement to another Twitter account, jquerysites. --Karl Karl Swedberg www.englishrules.com www.learningjquery.com On Oct 24, 2008, at 7:23 PM, Mika Tuupola wrote: I forgot who is running jQuery Twitter feed so I'll just ask here. How do you handle it? Do people send you tips on new websites using jQuery and new plugins? -- Mika Tuupola http://www.appelsiini.net/
[jQuery] Re: More efficient animation for multiple elements
Cool, I've never seen that site before. I made a small demo using my code above: http://jsbin.com/abuxe Strangely enough it's not working properly, and that's a direct copy of what I wrote that works. Basically they are all shrinking, and the on your mouse is over does not get larger. Not sure what I've done wrong here. Anyway, there's a 90% working demo... On Oct 24, 9:58 pm, ricardobeat [EMAIL PROTECTED] wrote: Maybe you could post a working sample to jsbin.com, that would make things a lot easier. On Oct 24, 4:00 pm, c.barr [EMAIL PROTECTED] wrote: Hate to bump this, but it might get lost otherwise!
[jQuery] Re: Hover with a fade question (n00b)
here is what it looks like without the fade: http://www.oddvice.com/switchertest/test.html I just want to add a simple fadeIn to the green button with the hover function. Here is the full code without any fadeIn: // JavaScript Document $(document).ready(function() { $('.button').click(function(event) { $('p').removeClass(); if (this.id == 'blueswitcher') { $('p').addClass('blue'); } else if (this.id == 'redswitcher') { $('p').addClass('red'); } $('.button').removeClass('selected'); $(this).addClass('selected'); event.stopPropagation(); }); }); $(document).ready(function() { $('.button').hover(function() { $(this).addClass('hover'); }, function() { $(this).removeClass('hover'); }); }); Thanks again. On Oct 24, 8:36 pm, gerbert [EMAIL PROTECTED] wrote: Thank you for cleaning that up, but it's still not quite right. It's not fading in, it just adds the class instantly. and when it fades out, it removes the div I put the .hover class on. Thanks for trying. On Oct 24, 8:03 pm, ricardobeat [EMAIL PROTECTED] wrote: $(document).ready(function() { $('.button').hover(function() { $(this).addClass('hover').fadeIn(); }, function() { $(this).removeClass('hover').fadeOut(); }); }); This should work, it's exactly the same as your second try but with correct syntax. On Oct 24, 11:54 pm, gerbert [EMAIL PROTECTED] wrote: Hi, I'm new to this group and to jQuery and javascript in general. I would like to learn how to use hover with a fade. I can do each separately but am having a hard time chaining them. Here's my best attempts at a simple hover button with a fadeIn and FadeOut: $(document).ready(function() { $('.button').hover(function() { $(this).fadeIn(1000,$('.button').addClass('hover')); }, function() { $(this).fadeOut(1000,$('.button').removeClass('hover')); }); }); That didn't work. Nor did this: $(document).ready(function() { $('.button').hover(function() { $(this).addClass('hover').fadeIn(1000); }, function() { $(this).removeClass('hover'.fadeOut(1000)); }); }); If anybody can help me out I'd be stoked. I've spent too much time on this seemingly simple effect. Thanks.
[jQuery] Re: li selection problem
this might sound dumb, but try using 'display:block;'? On Fri, Oct 24, 2008 at 4:32 PM, Alexandre Plennevaux [EMAIL PROTECTED] wrote: Yup I second Mike's advise. Make sure first that CSS allows it in a static demo file, then when you get it to work, you'll know what to script exactly. Just a remark $('ul ul li') is not the same as $('ul li'). In the first case it would only concern li which are inside an ul, inside another ul (so, excluding first-level ul). Second case concerns all LI elements. On Fri, Oct 24, 2008 at 10:11 PM, Michael Geary [EMAIL PROTECTED] wrote: Suggestion: Forget jQuery for a while. Instead, hand-edit an HTML file and see if you can get the styling the way you want. That way you don't have to troubleshoot both sides at once. All you have to worry about is the HTML and CSS. If you can get that to work, then you can duplicate the effect with jQuery. -Mike From: MartyB The more I am studying this, the more I am convinced that what I am trying to do is impossible. It is impossible to disassociate a child li background-color from the parent's, and still let jQuery apply the :even filter to all li's, sequencially for both parent and child.