[jQuery] Re: Focus First 'visible' field
Someone found that this method does not handle visibility correctly. When a visibility:hidden parent with a visibility:show child, the child would override its parent's property (of course!). So the script only need to check display:none parent, which would introduce another filter: $(:text:visible:enabled).filter(function(){ return $(this).filter(function(){ this.style.display == none; }).size()==0; }).eq(0).focus(); On 4月17日, 下午9時40分, Jacky [EMAIL PROTECTED] wrote: To work on any type of input should be easy, just replace ':text' with input. I know that IE would give error when you're focusing a 'disappearing' input. (parent is hidden, for example). But I do not encounter any error like you described. Any sample code for your HTML? On Tue, Apr 15, 2008 at 9:00 AM, MichaelEvangelista [EMAIL PROTECTED] wrote: I've been looking for a solution like this, but that will work with any type of form input. The code I've been using is below (where form-id is the ID of the containing form) It works great in Firefox but IE throws the error 'this.parentNode.borderCss.on' is null or not an object I tried your example code above, and got the same error here is what I was using : // --- Put the cursor in the first field on page load var $firstfield = function(){ $('#form-id input:eq(0)').focus(); } $firstfield(); Could this have anything to do with my markup? I didnt get that error on your demo, but i did when I applied your code to my form. On Apr 13, 7:54 am, Jacky See [EMAIL PROTECTED] wrote: Hi all, For focusing first input text field, the usual solution is $ (':text:visible:enabled:eq(0)').focus(). However, when these fields are in an ':hidden' parent (not 'visible' by our eyes), it won't work. Currently I tried to solve this by: $(:text:visible:enabled).filter(function(){ return $(this).parents(:hidden).size()==0; }).slice(0,1).focus(); I have setup a test page for this: http://www.seezone.net/dev/focusField.html Try to toggle different parent to and click 'focus'. It should work correctly. I would like to know if there is any other 'selector-based' way to do so? -- Best Regards, Jacky 網絡暴民http://jacky.seezone.net
[jQuery] Re: Focus First 'visible' field
Your inner $(this).filter(...) doesn't make sense to me. This works for me on FF2/Mac: $(':input:visible').filter(function() { return $(this).parents(':hidden').length == 0; }).slice(0,1).focus(); That is: Select all visible inputs elements, filter out any who have parents which are hidden, select the first one of those that remain, focus it. --Erik 2008/4/21 Jacky See [EMAIL PROTECTED]: Someone found that this method does not handle visibility correctly. When a visibility:hidden parent with a visibility:show child, the child would override its parent's property (of course!). So the script only need to check display:none parent, which would introduce another filter: $(:text:visible:enabled).filter(function(){ return $(this).filter(function(){ this.style.display == none; }).size()==0; }).eq(0).focus(); On 4月17日, 下午9時40分, Jacky [EMAIL PROTECTED] wrote: To work on any type of input should be easy, just replace ':text' with input. I know that IE would give error when you're focusing a 'disappearing' input. (parent is hidden, for example). But I do not encounter any error like you described. Any sample code for your HTML? On Tue, Apr 15, 2008 at 9:00 AM, MichaelEvangelista [EMAIL PROTECTED] wrote: I've been looking for a solution like this, but that will work with any type of form input. The code I've been using is below (where form-id is the ID of the containing form) It works great in Firefox but IE throws the error 'this.parentNode.borderCss.on' is null or not an object I tried your example code above, and got the same error here is what I was using : // --- Put the cursor in the first field on page load var $firstfield = function(){ $('#form-id input:eq(0)').focus(); } $firstfield(); Could this have anything to do with my markup? I didnt get that error on your demo, but i did when I applied your code to my form. On Apr 13, 7:54 am, Jacky See [EMAIL PROTECTED] wrote: Hi all, For focusing first input text field, the usual solution is $ (':text:visible:enabled:eq(0)').focus(). However, when these fields are in an ':hidden' parent (not 'visible' by our eyes), it won't work. Currently I tried to solve this by: $(:text:visible:enabled).filter(function(){ return $(this).parents(:hidden).size()==0; }).slice(0,1).focus(); I have setup a test page for this: http://www.seezone.net/dev/focusField.html Try to toggle different parent to and click 'focus'. It should work correctly. I would like to know if there is any other 'selector-based' way to do so? -- Best Regards, Jacky 網絡暴民http://jacky.seezone.net
[jQuery] Re: jMaps3 RC1 Released
HI there, I've just added a removeMarker function to the codebase last night and is in the tip version: http://hg.sharesource.org/jmaps/raw-file/5f67642a1526/docs/index.html#removemarker It's a bit of a quick fix, so might change - I'm thinking adding support for multiple markers instead of just one. I also need to work on the marker store, where you can place markers in the DOM to be easily accessed later. Hopefully this can get you started though. On Tue, Apr 22, 2008 at 2:13 AM, Ken Gregg [EMAIL PROTECTED] wrote: The page mentions adding and removing markers. I see addMarker is documented is there a removeMarker? On Apr 20, 7:29 am, Tane Piper [EMAIL PROTECTED] wrote: Hey folks, Today I am happy to announce that jMaps version 3 has been released today. This version is classed as a release candidate as I have not confirmed all bugs have been fixed, and some internals might still change slightly, however the API itself has stabilised. The plugin now has a proper page with API documentation and demos, and is available athttp://jmaps.digitalspaghetti.me.uk/ The plugin also now more modular, so you can write your own macros under the $.jmap namespace and call them using the $.jmap() function. I'll hopefully get some documentation on this written soon too. Id also like to get more feedback from users on where the plugin works well and not so well, and improve this for version 3.1. I'd also appreciate feedback on the documentation if its not very clear. -- Tane Piper Blog -http://digitalspaghetti.me.uk Skype: digitalspaghetti This email is: [ x ] blogable [ ] ask first [ ] private -- Tane Piper Blog - http://digitalspaghetti.me.uk Skype: digitalspaghetti This email is: [ ] blogable [ x ] ask first [ ] private
[jQuery] New and Learning JQuery
I been going through JQuery to add it to my knowledge base so I can integrate some of its functionality to our new web 2.0 UI for our applications which use to reside in RPG on IBM system i. I have created is a zebra list that I want to click on the list to help build the next page. There is a hidden element in the tr that is highlighted that I need the value of to build the URL for the next page. Im trying to use a this() that is then chained to get the value of that element, but Im having no luck. Any help will be appreciated. my jQuery looks like: script type=text/javascript $(document).ready(function(){ $(.stripeMe tr).click(function() { $this(); var MyVal = $(#LNAME).val(); javascript:location.href='test.htmlMyval=' + MyVal; }); $(.stripeMe tr).mouseover(function() {$ (this).addClass(over);}).mouseout(function() {$ (this).removeClass(over);}); $('.stripeMe tr:even').addClass('alt'); }); /script The HTML Looks like: table thead tr thLorem/th thIpsum/th thDolor/th thSit/th thAmet/th /tr /thead tbody class=stripeMe tr tdLorem/td tdIpsuminput type=hidden id=LNAME value=Ipsum1/td tdDolor/td tdSit/td tdAmet/td /tr tr ... So On and so forth with the same format as above Once again, once the user clicks a row tr I need to get the LNAME hidden element's value to build the URL that I will redirect the user to. Thanks in advance! Rob
[jQuery] Re: Focus First 'visible' field
This is my very first implementation. But it fails on visibility:hidden parent which has a visibility:show child. You may try the updated demo page. Box 11 would still be visible even when you toggle its parent's visibility. http://www.seezone.net/dev/focusField.html ':hidden' selector would try to select both display:none and visibility:hidden element. Therefore, we need to only select display:none parent, not visibility:hidden. P.S. (I missed 'return' in the previous post) $(:text:visible:enabled).filter(function(){ return $(this).filter(function(){ return this.style.display == none; }).size()==0; }).eq(0).focus(); 2008/4/22 Erik Beeson [EMAIL PROTECTED]: Your inner $(this).filter(...) doesn't make sense to me. This works for me on FF2/Mac: $(':input:visible').filter(function() { return $(this).parents(':hidden').length == 0; }).slice(0,1).focus(); That is: Select all visible inputs elements, filter out any who have parents which are hidden, select the first one of those that remain, focus it. --Erik 2008/4/21 Jacky See [EMAIL PROTECTED]: Someone found that this method does not handle visibility correctly. When a visibility:hidden parent with a visibility:show child, the child would override its parent's property (of course!). So the script only need to check display:none parent, which would introduce another filter: $(:text:visible:enabled).filter(function(){ return $(this).filter(function(){ this.style.display == none; }).size()==0; }).eq(0).focus(); On 4月17日, 下午9時40分, Jacky [EMAIL PROTECTED] wrote: To work on any type of input should be easy, just replace ':text' with input. I know that IE would give error when you're focusing a 'disappearing' input. (parent is hidden, for example). But I do not encounter any error like you described. Any sample code for your HTML? On Tue, Apr 15, 2008 at 9:00 AM, MichaelEvangelista [EMAIL PROTECTED] wrote: I've been looking for a solution like this, but that will work with any type of form input. The code I've been using is below (where form-id is the ID of the containing form) It works great in Firefox but IE throws the error 'this.parentNode.borderCss.on' is null or not an object I tried your example code above, and got the same error here is what I was using : // --- Put the cursor in the first field on page load var $firstfield = function(){ $('#form-id input:eq(0)').focus(); } $firstfield(); Could this have anything to do with my markup? I didnt get that error on your demo, but i did when I applied your code to my form. On Apr 13, 7:54 am, Jacky See [EMAIL PROTECTED] wrote: Hi all, For focusing first input text field, the usual solution is $ (':text:visible:enabled:eq(0)').focus(). However, when these fields are in an ':hidden' parent (not 'visible' by our eyes), it won't work. Currently I tried to solve this by: $(:text:visible:enabled).filter(function(){ return $(this).parents(:hidden).size()==0; }).slice(0,1).focus(); I have setup a test page for this: http://www.seezone.net/dev/focusField.html Try to toggle different parent to and click 'focus'. It should work correctly. I would like to know if there is any other 'selector-based' way to do so? -- Best Regards, Jacky 網絡暴民http://jacky.seezone.net -- Best Regards, Jacky 網絡暴民 http://jacky.seezone.net
[jQuery] problem closing browser events (unload funtion)
hi, I want a simple ajax event to be fired when user closes the browser; the code below sometimes works, sometimes not... and don't know the reason. someone has an idea why does it happen? I suppose it's about browser behaviour... (tested by firefox 2.0) And if I wanna apply this when a user closes a browser tab, is it possible? (I think unload affects only when you close the browser, not any tab) jQuery(window).unload(function() { $.get('http://localhost/fitxers/borvdrar.php'); }); //the php deletes info from a database (postgreSQL) given a userid thanks! PEre -- View this message in context: http://www.nabble.com/problem-closing-browser-events-%28unload-funtion%29-tp16823733s27240p16823733.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: New and Learning JQuery
I *think* you are after something like this: script type=text/javascript $(.stripeMe tr).click(function() { var MyVal = $(#LNAME, this).val(); javascript:location.href='test.htmlMyval=' + MyVal; }); /script having a line that says $this(); doesn't really do anything, if it doesn't outright cause an error. this in JavaScript is always context sensitive and normally refers to the object that triggered an event, or the call to the function. (this is a gross simplification, but). With that in mind, each time your click function gets executed, this will refer to the .stripeMe tr object that initiated the click. Now, there are a bunch of ways to use this. And for what you are after, there are a number of different approaches. The sample I provided above says find all objects with an id of #LNAME relative to the 'this' object. In terms of the DOM, only objects that are a child, or grandchild of the object represented by 'this' will be found (if any). You could change this to avoid the context bit with something like $(this).find(#LNAME).val() Whatever works best for you, and that you understand. Hope that helps. Shawn binro01 wrote: I been going through JQuery to add it to my knowledge base so I can integrate some of its functionality to our new web 2.0 UI for our applications which use to reside in RPG on IBM system i. I have created is a zebra list that I want to click on the list to help build the next page. There is a hidden element in the tr that is highlighted that I need the value of to build the URL for the next page. Im trying to use a this() that is then chained to get the value of that element, but Im having no luck. Any help will be appreciated. my jQuery looks like: script type=text/javascript $(document).ready(function(){ $(.stripeMe tr).click(function() { $this(); var MyVal = $(#LNAME).val(); javascript:location.href='test.htmlMyval=' + MyVal; }); $(.stripeMe tr).mouseover(function() {$ (this).addClass(over);}).mouseout(function() {$ (this).removeClass(over);}); $('.stripeMe tr:even').addClass('alt'); }); /script The HTML Looks like: table thead tr thLorem/th thIpsum/th thDolor/th thSit/th thAmet/th /tr /thead tbody class=stripeMe tr tdLorem/td tdIpsuminput type=hidden id=LNAME value=Ipsum1/td tdDolor/td tdSit/td tdAmet/td /tr tr ... So On and so forth with the same format as above Once again, once the user clicks a row tr I need to get the LNAME hidden element's value to build the URL that I will redirect the user to. Thanks in advance! Rob
[jQuery] [ TOOLTIP ] - Can I PULL IN the CONTENTS of the URL into the tooltip itself?
One of the tooltip-demos shows this embedded HTML, but somehow this is much more sophisticated than what I need. Is there a way how I can make the tooltip show the CONTENT of the url in the tooltip. For example, if the link points to x.html, and x.html contains Hello World, I want to see Hello World in the tooltip rather than x.html. Is this possible with the JQuery Tooltip? I imagine it must be possible because this embedded HTML example seems more sophisticated than what I'm trying to do, but I just can't figure it out by myself. Thanks in advance massively for any advice ! ML
[jQuery] Re: Adding load to ajax POST function
thanks On Apr 20, 3:28 pm, Sephi-Chan [EMAIL PROTECTED] wrote: Hello, You can look the code of the load function in the jQuery source. It's what i did few days ago whereas i want do this (filter the response). I make something like this : $.ajax({ url : 'remotePage.php', dataType : 'html', complete : function(response){ var filteredResponse = jQuery(div /).append( response.responseText.replace( /script(.|\s)*?\/script/g, ) ).find('div#ajax'); $('div#ajaxContent').append((html)); } }); This script take only the text which is in the div#ajax bloc in the remote page. Then this content is put in the div#ajaxContent of the calling page. Sephi-Chan -- View this message in context:http://www.nabble.com/Adding-load-to-ajax-POST-function-tp16799597s27... Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: post a list of values from a function
I found my answer - I needed to use options $.ajax({ type: post, url: Proc.asp, data: cmd=ups+ mystring, success: function(data){ $(#cnts).html(data); .. On Apr 21, 7:09 pm, webber [EMAIL PROTECTED] wrote: using $.post(ajaxProc.asp, { cmd:'ups', mystring} mystring is a list of values created by a function that returns a result like city:phoenix,state:arizona, etc. I want to add it to the post but I get back an error saying it's missing the colon . my guess is that it thinks mystring is the first part of the named pair. I know mystring is holding the correct information because I can view it from the alert. how can I place mystring into the post so it gets processed correctly for the values it contains? thanks
[jQuery] Re: Confused...is JQuery and EXT still being integrated together?
the beauty of jquery is to keep it simple . On Apr 21, 8:35 pm, Rey Bango [EMAIL PROTECTED] wrote: For the foreseeable future, we're focusing our efforts on jQuery UI and ensuring that the rich set of functionality in the library is top notch. The jQuery adapter which allows Ext to use the jQuery core is still available as part of the Ext download but we're not working with them on anything at the moment. Rey... VitC wrote: Feb 07 was an announcement that JQuery and EXT were going to integrate together. But it appears noting is happening? Is this what the ui.jquery.com is? Of have each separated... Thanks...
[jQuery] Re: New and Learning JQuery
Thanks Shawn! This explanation of (this) helped me a great deal! And helped my application! Rob On Apr 22, 5:33 am, Shawn [EMAIL PROTECTED] wrote: I *think* you are after something like this: script type=text/javascript $(.stripeMe tr).click(function() { var MyVal = $(#LNAME, this).val(); javascript:location.href='test.htmlMyval=' + MyVal; }); /script having a line that says $this(); doesn't really do anything, if it doesn't outright cause an error. this in JavaScript is always context sensitive and normally refers to the object that triggered an event, or the call to the function. (this is a gross simplification, but). With that in mind, each time your click function gets executed, this will refer to the .stripeMe tr object that initiated the click. Now, there are a bunch of ways to use this. And for what you are after, there are a number of different approaches. The sample I provided above says find all objects with an id of #LNAME relative to the 'this' object. In terms of the DOM, only objects that are a child, or grandchild of the object represented by 'this' will be found (if any). You could change this to avoid the context bit with something like $(this).find(#LNAME).val() Whatever works best for you, and that you understand. Hope that helps. Shawn binro01 wrote: I been going through JQuery to add it to my knowledge base so I can integrate some of its functionality to our new web 2.0 UI for our applications which use to reside in RPG on IBM system i. I have created is a zebra list that I want to click on the list to help build the next page. There is a hidden element in the tr that is highlighted that I need the value of to build the URL for the next page. Im trying to use a this() that is then chained to get the value of that element, but Im having no luck. Any help will be appreciated. my jQuery looks like: script type=text/javascript $(document).ready(function(){ $(.stripeMe tr).click(function() { $this(); var MyVal = $(#LNAME).val(); javascript:location.href='test.htmlMyval=' + MyVal; }); $(.stripeMe tr).mouseover(function() {$ (this).addClass(over);}).mouseout(function() {$ (this).removeClass(over);}); $('.stripeMe tr:even').addClass('alt'); }); /script The HTML Looks like: table thead tr thLorem/th thIpsum/th thDolor/th thSit/th thAmet/th /tr /thead tbody class=stripeMe tr tdLorem/td tdIpsuminput type=hidden id=LNAME value=Ipsum1/td tdDolor/td tdSit/td tdAmet/td /tr tr ... So On and so forth with the same format as above Once again, once the user clicks a row tr I need to get the LNAME hidden element's value to build the URL that I will redirect the user to. Thanks in advance! Rob
[jQuery] BBC.co.uk style image switcher
Hi there, hope you can help. I'm looking for some javascript to create the same sort of effect the bbc.co.uk site has, when you roll over one of the news articles, the image changes. Is there anything in jquery js that does this? I'm a complete newbie to js i'm not sure where to start looking. Or, and forgive me if this is a very stupid question, but i can see that the code they have used is script type=text/javascript var newsBoxImages = [ { 'alt' : Harvesting switchgrass (Image: Jerry Roitsch) , 'src' : http://www.bbc.co.uk/feedengine/homepage/images/news/ _44339803_bailing203roitsch_index_146x110.jpg } , { 'alt' : Laptop, Science Photo Library , 'src' : http://www.bbc.co.uk/feedengine/homepage/images/news/ _44366715_laptop203i_146x110.jpg } ]; /script would it be a case of dropping this js into my page and changing the image paths to point at my own? Any help would be greatly appreciated. Thanks in advance.
[jQuery] Re: Cycle plugin with many image tabs
I'm using the cycle plugin and have set it up to automagically create the tabs for changing to the next image. http://www.actionhobby.ca/index.php?q=/node/524 But, this particular page has 32 images (possibly more to come). The tabs are generated in a single row, and do not wrap at the edge of the screen. So I'm looking for ideas how to resolve this. (works great on a 1650x1024 page, not so great at smaller resolutions) Can this be handled via CSS? Or am I going to be tweaking code? Give them a float:left style and then add margins, etc. Also, give the slideshow a clear:left style. Mike
[jQuery] Re: BBC.co.uk style image switcher
Hi there, I'm not sure if there is a plugin defineing exatcly the behaviour you need. You can check it here: http://plugins.jquery.com/. Nevertheless it's easy to implement such behaviour with jQuery. First of all you need to make a html code that will present a single link with picture. Make it looking exactly as you want. Mind that html structure should be easy to traverse with jQuery (like ul, ol). Next step is to put more links with pictures for them in a way that only one is visible, first for example. At the end write some js. The code should be run at the document load event. What you need it to grab your links (a) and bind on them an event hover. When you bind an event you pass a callback function which will be fired when the event occures. Your callback function sholud hide an image that is visible and show the image related to the link beeing hovered. That's it! God-speed :) 2008/4/22 vneal [EMAIL PROTECTED]: Hi there, hope you can help. I'm looking for some javascript to create the same sort of effect the bbc.co.uk site has, when you roll over one of the news articles, the image changes. Is there anything in jquery js that does this? I'm a complete newbie to js i'm not sure where to start looking. Or, and forgive me if this is a very stupid question, but i can see that the code they have used is script type=text/javascript var newsBoxImages = [ { 'alt' : Harvesting switchgrass (Image: Jerry Roitsch) , 'src' : http://www.bbc.co.uk/feedengine/homepage/images/news/ _44339803_bailing203roitsch_index_146x110.jpghttp://www.bbc.co.uk/feedengine/homepage/images/news/_44339803_bailing203roitsch_index_146x110.jpg } , { 'alt' : Laptop, Science Photo Library , 'src' : http://www.bbc.co.uk/feedengine/homepage/images/news/ _44366715_laptop203i_146x110.jpghttp://www.bbc.co.uk/feedengine/homepage/images/news/_44366715_laptop203i_146x110.jpg } ]; /script would it be a case of dropping this js into my page and changing the image paths to point at my own? Any help would be greatly appreciated. Thanks in advance. http://www.ludwinski.net
[jQuery] Re: AJAX Cancel? (sorry, hit post before I was done)
Thanks, What I ended up doing was grabbing the current time before I make the AJAX call, and then storing it in a latest_keypress_time data variable in the textbox jQuery object. Then, in the callback, compare the keypress_time from before the AJAX call to the latest_keypress_time data variable, to see if the one we're processing is the latest one. $(#my_textbox).keyup(function() { var textbox = this; var keypress_time = new Date(); $(textbox).data(latest_keypress_time, keypress_time); // other code... $.get(ajax_script.php, data, function(response) { if (keypress_time $(textbox).data(latest_keypress_time)) { return; } // end if (keypress_time , $ (textbox).data(latest_keypress_time)) // other callback code }); // end $.get() }); // end $(#my_textbox).keyup() Works *fairly* well - as long as you don't type faster than one keypress per millisecond. :) Jamie On Apr 21, 5:18 pm, Donald J Organ IV [EMAIL PROTECTED] wrote: You would need something to keep track of the time between keyDown events then just pick the amount of time you want to trigger on. livefree75 wrote:Hi, I have an AJAX GET going out on KeyUp on a text box. I want to Cancel the request or ignore the response if a new AJAX request has gone out since the first one began. In other words, I only want to process the AJAX request when the user is done entering. a la GMail address lookup. What's the best way to do this? Jamie
[jQuery] Re: New and Learning JQuery
And just to point something out... Duplicate id's are never good on a page... I think you're better off by setting either the 'name' or the 'class' attribute of the hidden input. A page will never pass validation if it has duplicate id's on it and some of your javascript my freak out. Greetz, Wizz On Apr 22, 1:44 pm, binro01 [EMAIL PROTECTED] wrote: Thanks Shawn! This explanation of (this) helped me a great deal! And helped my application! Rob On Apr 22, 5:33 am, Shawn [EMAIL PROTECTED] wrote: I *think* you are after something like this: script type=text/javascript $(.stripeMe tr).click(function() { var MyVal = $(#LNAME, this).val(); javascript:location.href='test.htmlMyval=' + MyVal; }); /script having a line that says $this(); doesn't really do anything, if it doesn't outright cause an error. this in JavaScript is always context sensitive and normally refers to the object that triggered an event, or the call to the function. (this is a gross simplification, but). With that in mind, each time your click function gets executed, this will refer to the .stripeMe tr object that initiated the click. Now, there are a bunch of ways to use this. And for what you are after, there are a number of different approaches. The sample I provided above says find all objects with an id of #LNAME relative to the 'this' object. In terms of the DOM, only objects that are a child, or grandchild of the object represented by 'this' will be found (if any). You could change this to avoid the context bit with something like $(this).find(#LNAME).val() Whatever works best for you, and that you understand. Hope that helps. Shawn binro01 wrote: I been going through JQuery to add it to my knowledge base so I can integrate some of its functionality to our new web 2.0 UI for our applications which use to reside in RPG on IBM system i. I have created is a zebra list that I want to click on the list to help build the next page. There is a hidden element in the tr that is highlighted that I need the value of to build the URL for the next page. Im trying to use a this() that is then chained to get the value of that element, but Im having no luck. Any help will be appreciated. my jQuery looks like: script type=text/javascript $(document).ready(function(){ $(.stripeMe tr).click(function() { $this(); var MyVal = $(#LNAME).val(); javascript:location.href='test.htmlMyval=' + MyVal; }); $(.stripeMe tr).mouseover(function() {$ (this).addClass(over);}).mouseout(function() {$ (this).removeClass(over);}); $('.stripeMe tr:even').addClass('alt'); }); /script The HTML Looks like: table thead tr thLorem/th thIpsum/th thDolor/th thSit/th thAmet/th /tr /thead tbody class=stripeMe tr tdLorem/td tdIpsuminput type=hidden id=LNAME value=Ipsum1/td tdDolor/td tdSit/td tdAmet/td /tr tr ... So On and so forth with the same format as above Once again, once the user clicks a row tr I need to get the LNAME hidden element's value to build the URL that I will redirect the user to. Thanks in advance! Rob
[jQuery] Re: bug tracker error
Same problem here. Please help, folks. On Apr 21, 11:33 am, PragueExpat [EMAIL PROTECTED] wrote: I can only open the link one or two times. Refreshing the page again gives me the error. Am I the only one? (tested FF2 on linux and windows) On Apr 17, 4:39 pm, PragueExpat [EMAIL PROTECTED] wrote: anyone getting this error when trying to open a bug report? http://dev.jquery.com/report/19 Trac detected an internal error: IntegrityError: (1062, Duplicate entry '690bd2f84578796-0-0' for key 1)
[jQuery] Make Readonly input text
Hi, I'm newbie here there is two input form, checkbox and text. i want if I checked the chekbox, the input text will become readonly, and if i checked again, the input text back to normal. I'm trying make this function function makeReadOnly(a) { if ($(a:contains('readonly'))) { $(readonly = 'readonly').replaceWith( ); } else { $(a).append(readonly = 'readonly'); } } but its not working. firebug says that replaceWith is not a function. anybody can help me out?
[jQuery] Re: bug tracker error
I found that if you remove all cookies from dev.jquery.com, you can reload the page. On Apr 22, 4:12 pm, Jeremy Stanton [EMAIL PROTECTED] wrote: Same problem here. Please help, folks. On Apr 21, 11:33 am, PragueExpat [EMAIL PROTECTED] wrote: I can only open the link one or two times. Refreshing the page again gives me the error. Am I the only one? (tested FF2 on linux and windows) On Apr 17, 4:39 pm, PragueExpat [EMAIL PROTECTED] wrote: anyone getting this error when trying to open a bug report? http://dev.jquery.com/report/19 Trac detected an internal error: IntegrityError: (1062, Duplicate entry '690bd2f84578796-0-0' for key 1)
[jQuery] Re: SOT: Using iframe to load in a Flash movie with dynamic height
Just messed with it for about an hour or so and it's not the overflow. Tried every possible combination of values and nothing. I think I've narrowed it to down to the Flash movie, and not Javascript. -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of mrpollo Sent: Monday, April 21, 2008 8:03 PM To: jQuery (English) Subject: [jQuery] Re: SOT: Using iframe to load in a Flash movie with dynamic height it sounds to me its an overflow problem IE does that a lot of the time, maybe position:absolute; and giving it a height:0px; would fix the IE problem google for IE DIV OVERFLOW youll find tons of solutions just encountered with this problem last night with a flash also, but no iframe still same luck hope this helps On Apr 18, 9:31 am, Andy Matthews [EMAIL PROTECTED] wrote: I've been dealing with this irritating issue on and off now for about a month. I'm finally going to ask for help. I have a page here:http://lexusofdanversma.redlinecontent.com/Pages/Page.cfm?pageID= 118873 It contains a Flash movie whose height is set dynamically based on it's content. The Flash movie might be 250px tall, or it might be 700px tall depending on what it's currently displaying. This page works perfectly. However the client has another site on which they have an iframe which loads in the above page. On THAT page, the content of the Flash movie is getting cut off for some reason. You can see my quick example here: http://www.commadelimited.com/uploads/iframe.html Notice that when the Flash movie first loads, the bottom inch or so is getting cut off. Does anyone have any idea why this is happening, or how I might go about fixing it? Thanks in advance for any help you can provide. Andy Matthews Senior ColdFusion Developer Office: 615.627.9747 Fax: 615.467.6249www.dealerskins.comhttp://www.dealerskins.com/ Total customer satisfaction is my number 1 priority! If you are not completely satisfied with the service I have provided, please let me know right away so I can correct the problem, or notify my manager Aaron West at [EMAIL PROTECTED] 2008 Email NADA.jpg 17KViewDownload
[jQuery] ie still stalling at html rewrite
I hope someone more experienced can tell me where I'm going wrong with this? I have PHP generate the jQuery for an .html() rewrite of links, replacing the less-jazzy non-javascript show/hide alternative. It works like a charm in FF, but ie refuses at this point will not go any further. The error occurs, apparently at this point in jQuery source: (elem,select)))return;if(elem[0]==undefined|| jQuery.nodeName(elem,form)||elem.options)ret.push(elem);else but I don't know what that means! My generated code: $( 'h2.product1' ).html( 'a href=#productID class=openProduct name/a' ); $( '#productID' ).css( 'margin-top', '0px;' ); $( '#productID .close' ).html( 'a href=#productID class=closeimg src=images/close.jpg alt=Close title=Close / /a' ); In fact, IE doesn't even write in the new h2 data. It stops processing all Javascript at that point. I thought this post, regarding ie's dislike of jQuery's .html() method, was the answer: http://groups.google.com/group/jquery-en/browse_frm/thread/fea89caebdbb8453# but it doesn't help :( After so long tugging away at this, I'm hoping it's due to one of my elementary errors!! So please tell me where I'm wrong :) Thanks, Cherry
[jQuery] Re: Make Readonly input text
Use the attr function On Apr 22, 3:19 pm, Andri [EMAIL PROTECTED] wrote: Hi, I'm newbie here there is two input form, checkbox and text. i want if I checked the chekbox, the input text will become readonly, and if i checked again, the input text back to normal. I'm trying make this function function makeReadOnly(a) { if ($(a:contains('readonly'))) { $(readonly = 'readonly').replaceWith( ); } else { $(a).append(readonly = 'readonly'); } } but its not working. firebug says that replaceWith is not a function. anybody can help me out?
[jQuery] Re: Cycle plugin an absolute positioning
Thanks helped a lot. An added note. For Firefox the $('div.pics a').each(function() { $(this).css({left: '50%', marginLeft: -$(this).width()/ 2}); }); needs to happen before you start the cycle plugin. Otherwise for some reason only the first photo is centered. On Mar 14, 8:56 am, caruso_g [EMAIL PROTECTED] wrote: Hi Rick, thanks a lot for your reply. The problem is that auto margins don't work since the elements are absolute positioned. The absolute positioning is necessary to let elements be one on the other one when animating. The good new is that I found the solution. I know that for all the devs out there is stupid but to me it took half day of work and attempts... :P Here it is my solution: $('div.pics a').each(function() { $(this).css({left: '50%', marginLeft: -$(this).width()/2}); }); If someone wants to comment it, or if it could be improved in any way, I would love to read your posts. Thank you all again. On Mar 14, 2:24 pm, Rick [EMAIL PROTECTED] wrote: Well you can try using: margin-left:auto; margin-right auto; this does not work in msie, but in msie you can do a expression left:50% elm.style.setExpression(marginLeft,-+this.parentNode.offsetHeight/ 2) On 14 mrt, 12:57, caruso_g [EMAIL PROTECTED] wrote: May anyone help me, please? Mike...? Thank you all! On Mar 13, 10:49 pm, caruso_g [EMAIL PROTECTED] wrote: Hi all guys, I have a problem with the fantastic Cycle plugin. I have a group on images links whose I can't know their dimensions in advance. So the images sizes the customer will use will vary. The Cycle plugin give the element an absolute positioning (so left 0 and top 0). Since I need to center those images link in their container, I have the problem to dynamically know their width to give the image link a left position 50% and a left-margin -the-image-size/2 just to center it. Well, as you can see, I can say it in words, but sadly I am not able to translate it in jQuery language. Can someone help me? And above all, can try to explain me the modus operandi on how to arrive to the code? I would like to learn the pattern to find these kind of solutions and be able to do it myself. Btw, thanks to Remy Sharp the author of jQuery For Designers[http:// jqueryfordesigners.com/] he is quite prefect in his tutorial, and above all doesn't jump any step, and show us the code verbose before to short it! Great resource! This is the online example page:http://www.bonsai-studio.net/clients/lamoy/wessel04/speed/ Thanks to anyone that can help me.
[jQuery] Re: Problem positioning an absolute element
And what is with this post showing up 7 times?? I only hit the submit button once on Google Groups. Hope no one thinks I am spamming. :( On Apr 17, 8:01 pm, AsymF [EMAIL PROTECTED] wrote: I recently implemented the following CSS layout on a site in place of a previous table layout:http://www.pmob.co.uk/temp/3colfixedtest_sourcenone.htm After doing so I cannot get DIVs to position correctly in some instances when using jQuery to do so. One in particular is too far down and over to the right. Unfortunately I don't have a page to show because the code is on a backend area that requires login. However, the code I was previously using that worked great to cause a box to display right below a link is this: __ $('div#box').css('position', 'absolute'); $('div#box').css('left', $('a#link').offset().left); $('div#box').css('top', ($('a#link').offset().top + $ ('a#link').outerHeight() + 2)); $('div#box').show('normal'); __ However, I found that I now need to add or subtract the padding and margins from enclosing DIVs due to the new CSS layout and I am perplexed as to why: __ $('div#box').css('position', 'absolute'); margin_left = $('div#outer').css('margin-left'); margin_left = margin_left.substring(0, margin_left.indexOf('px')); pad_right = $('div#centrecontent').css('padding-right'); pad_right = pad_right.substring(0, pad_right.indexOf('px')); $('div#box').css('left', ($('a#link').offset().left + pad_right - margin_left)); pad_top = $('div#outer').css('padding-top'); pad_top = pad_top.substring(0, pad_top.indexOf('px')); $('div#box').css('top', ($('a#link').offset().top + $ ('a#link').outerHeight() + 2 - pad_top)); $('div#box').show('normal'); __ Even more perplexing is that if I leave pad_right inside those calculations it causes the box to fly about 5160 pixels off to the right of the screen. Checking the value in the console shows that pad_right has a value of 6. If I remove pad_right and directly substitute in the number 6 then the box positions normally. Can anyone help explain to me what I am doing wrong here?
[jQuery] Re: SOT: Using iframe to load in a Flash movie with dynamic height
Andy,Are you talking about the scroll bar appearing? As Dan pointed out, you can get rid of that by setting the padding and margin of the body of the page INSIDE the iframe to 0, and do the same for the form. They're taking on their default values. I was able to do this with firebug. I see that there is another iframe nested inside, so what I'm talking about is the outer iframe that has a src= http://lexusofdanversma.redlinecontent.com/Pages/Page.cfm?pageID=118873 Hope that helps - let me know if that didn't make sense rolfsf On Tue, Apr 22, 2008 at 8:23 AM, Andy Matthews [EMAIL PROTECTED] wrote: Just messed with it for about an hour or so and it's not the overflow. Tried every possible combination of values and nothing. I think I've narrowed it to down to the Flash movie, and not Javascript. -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of mrpollo Sent: Monday, April 21, 2008 8:03 PM To: jQuery (English) Subject: [jQuery] Re: SOT: Using iframe to load in a Flash movie with dynamic height it sounds to me its an overflow problem IE does that a lot of the time, maybe position:absolute; and giving it a height:0px; would fix the IE problem google for IE DIV OVERFLOW youll find tons of solutions just encountered with this problem last night with a flash also, but no iframe still same luck hope this helps On Apr 18, 9:31 am, Andy Matthews [EMAIL PROTECTED] wrote: I've been dealing with this irritating issue on and off now for about a month. I'm finally going to ask for help. I have a page here:http://lexusofdanversma.redlinecontent.com/Pages/Page.cfm?pageID= 118873 It contains a Flash movie whose height is set dynamically based on it's content. The Flash movie might be 250px tall, or it might be 700px tall depending on what it's currently displaying. This page works perfectly. However the client has another site on which they have an iframe which loads in the above page. On THAT page, the content of the Flash movie is getting cut off for some reason. You can see my quick example here: http://www.commadelimited.com/uploads/iframe.html Notice that when the Flash movie first loads, the bottom inch or so is getting cut off. Does anyone have any idea why this is happening, or how I might go about fixing it? Thanks in advance for any help you can provide. Andy Matthews Senior ColdFusion Developer Office: 615.627.9747 Fax: 615.467.6249www.dealerskins.comhttp://www.dealerskins.com/ Total customer satisfaction is my number 1 priority! If you are not completely satisfied with the service I have provided, please let me know right away so I can correct the problem, or notify my manager Aaron West at [EMAIL PROTECTED] 2008 Email NADA.jpg 17KViewDownload
[jQuery] Help Needed Passing Checkbox Values to SELECT Element
I'm not the world's greatest Jquery coder so I'm hoping someone can help me with this. I have a client that needs me to pass the VALUES of certain items checked in one form, to a select box in another form. I've been successful at doing this between two select elements, but can't seem to get it to work between checkboxes and a select element. Here's the code I have thus far: $('#saveclose').click(function() { return !$('form#runitsform [EMAIL PROTECTED]runits]:checked').appendTo('form#command #roleSelect'); }); Now (in Firefox only), this does do something -- it send the checkbox itself to the Select box in the other form. What I need is for the VALUES of the checked boxes to be sent over instead. I've been doing some reading up on it and I realize I have to use .val() somehow but everywhere I've tried it I either get errors or nothing happens. Any help would be much appreciated. When this deadline is through, I'm definitely sitting down to learn Jquery better :-) Cheers.
[jQuery] Getting value of input type=file
I am using ajax to post a form that has an image upload input field. I tried getting the value as I do with other inputs, but it does not seem to work, and returns undefined: var imageUpload = $(#image_0).val(); input type=file name=image_0 class=sq-form-field / Am I missing something here?
[jQuery] Re: Problem positioning an absolute element
i see no div called box at leats firebug doesnt On Apr 22, 9:53 am, AsymF [EMAIL PROTECTED] wrote: And what is with this post showing up 7 times?? I only hit the submit button once on Google Groups. Hope no one thinks I am spamming. :( On Apr 17, 8:01 pm, AsymF [EMAIL PROTECTED] wrote: I recently implemented the following CSS layout on a site in place of a previous table layout:http://www.pmob.co.uk/temp/3colfixedtest_sourcenone.htm After doing so I cannot get DIVs to position correctly in some instances when using jQuery to do so. One in particular is too far down and over to the right. Unfortunately I don't have a page to show because the code is on a backend area that requires login. However, the code I was previously using that worked great to cause a box to display right below a link is this: __ $('div#box').css('position', 'absolute'); $('div#box').css('left', $('a#link').offset().left); $('div#box').css('top', ($('a#link').offset().top + $ ('a#link').outerHeight() + 2)); $('div#box').show('normal'); __ However, I found that I now need to add or subtract the padding and margins from enclosing DIVs due to the new CSS layout and I am perplexed as to why: __ $('div#box').css('position', 'absolute'); margin_left = $('div#outer').css('margin-left'); margin_left = margin_left.substring(0, margin_left.indexOf('px')); pad_right = $('div#centrecontent').css('padding-right'); pad_right = pad_right.substring(0, pad_right.indexOf('px')); $('div#box').css('left', ($('a#link').offset().left + pad_right - margin_left)); pad_top = $('div#outer').css('padding-top'); pad_top = pad_top.substring(0, pad_top.indexOf('px')); $('div#box').css('top', ($('a#link').offset().top + $ ('a#link').outerHeight() + 2 - pad_top)); $('div#box').show('normal'); __ Even more perplexing is that if I leave pad_right inside those calculations it causes the box to fly about 5160 pixels off to the right of the screen. Checking the value in the console shows that pad_right has a value of 6. If I remove pad_right and directly substitute in the number 6 then the box positions normally. Can anyone help explain to me what I am doing wrong here?
[jQuery] Re: SOT: Using iframe to load in a Flash movie with dynamic height
Rolf... The interior page also has an iframe, but that's a non-issue. It's what we use to store history state for the Flash app. If you view the main interior page in IE outside of the frameset, you'll see that after it loads, the height of the Flash movie increases. When it's inside the iframe, the movie doesn't resize (why God, why?). _ From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of rolf m Sent: Tuesday, April 22, 2008 12:49 PM To: jquery-en@googlegroups.com Subject: [jQuery] Re: SOT: Using iframe to load in a Flash movie with dynamic height Andy, Are you talking about the scroll bar appearing? As Dan pointed out, you can get rid of that by setting the padding and margin of the body of the page INSIDE the iframe to 0, and do the same for the form. They're taking on their default values. I was able to do this with firebug. I see that there is another iframe nested inside, so what I'm talking about is the outer iframe that has a src=http://lexusofdanversma.redlinecontent.com/Pages/Page.cfm?pageID=118873 Hope that helps - let me know if that didn't make sense rolfsf On Tue, Apr 22, 2008 at 8:23 AM, Andy Matthews [EMAIL PROTECTED] wrote: Just messed with it for about an hour or so and it's not the overflow. Tried every possible combination of values and nothing. I think I've narrowed it to down to the Flash movie, and not Javascript. -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of mrpollo Sent: Monday, April 21, 2008 8:03 PM To: jQuery (English) Subject: [jQuery] Re: SOT: Using iframe to load in a Flash movie with dynamic height it sounds to me its an overflow problem IE does that a lot of the time, maybe position:absolute; and giving it a height:0px; would fix the IE problem google for IE DIV OVERFLOW youll find tons of solutions just encountered with this problem last night with a flash also, but no iframe still same luck hope this helps On Apr 18, 9:31 am, Andy Matthews [EMAIL PROTECTED] wrote: I've been dealing with this irritating issue on and off now for about a month. I'm finally going to ask for help. I have a page here:http://lexusofdanversma.redlinecontent.com/Pages/Page.cfm?pageID= 118873 It contains a Flash movie whose height is set dynamically based on it's content. The Flash movie might be 250px tall, or it might be 700px tall depending on what it's currently displaying. This page works perfectly. However the client has another site on which they have an iframe which loads in the above page. On THAT page, the content of the Flash movie is getting cut off for some reason. You can see my quick example here: http://www.commadelimited.com/uploads/iframe.html Notice that when the Flash movie first loads, the bottom inch or so is getting cut off. Does anyone have any idea why this is happening, or how I might go about fixing it? Thanks in advance for any help you can provide. Andy Matthews Senior ColdFusion Developer Office: 615.627.9747 Fax: 615.467.6249www.dealerskins.comhttp://www.dealerskins.com/ Total customer satisfaction is my number 1 priority! If you are not completely satisfied with the service I have provided, please let me know right away so I can correct the problem, or notify my manager Aaron West at [EMAIL PROTECTED] 2008 Email NADA.jpg 17KViewDownload
[jQuery] Re: Getting value of input type=file
You are currently accessing that input by id. You currently don't have an id in that particular input field. You have the name as image_0. the selector is actually $('[name=image_0]').val(); so try: var imageUpload=$('[name=image_0]').val(); You understand why right? On Apr 22, 1:57 pm, hubbs [EMAIL PROTECTED] wrote: I am using ajax to post a form that has an image upload input field. I tried getting the value as I do with other inputs, but it does not seem to work, and returns undefined: var imageUpload = $(#image_0).val(); input type=file name=image_0 class=sq-form-field / Am I missing something here?
[jQuery] Re: [validate] value is trimmed before getting to validation function
sebastian schrieb: Hi, i'm developing a costum validation method for a password field, the password must not contain spaces. I thought my method worked fine until during a test i put a space at the end of the password, my method returned that the password was correct, and i noticed that the problem was that the value of the field is trimmed before it is sent to the validation method. And I thought it might be a good idea not to trim the values before they are sent to the validation methods, what do you think? Instead of using the trimmed value in your method, use the second argument, which points to the element itself, and get the value from there, via element.value Jörn
[jQuery] Re: [validate] validation doesn't work for radio buttons associated with hidden field
sebastian schrieb: Hi, the problem i have is that I have a group of radio buttons associated with a hidden field like this: input type=hidden name=data[User][gender] value= id=UserGender_ / input type=radio name=data[User][gender] id=UserGenderF value=f / label for=UserGenderFFemale/label input type=radio name=data[User][gender] id=UserGenderM value=m / label for=UserGenderMMale/label and I have the following validation rule for the element: data[User][gender]:required the validation doesn't work , it always shows an error whether the radio buttons are selected or not. Please help. The required-method doesn't support mixed types. In your setup, only the hidden field is validated, which is always invalid. You could implement a custom required-method for this case. Take a look at the current required-implementation for reference validating the group of radio buttons. Jörn
[jQuery] Re: Getting value of input type=file
Yes, I understand. I am just being a dummy and not looking at it closely. Thanks, I will try this. On Apr 22, 11:26 am, Chris J. Lee [EMAIL PROTECTED] wrote: You are currently accessing that input by id. You currently don't have an id in that particular input field. You have the name as image_0. the selector is actually $('[name=image_0]').val(); so try: var imageUpload=$('[name=image_0]').val(); You understand why right? On Apr 22, 1:57 pm, hubbs [EMAIL PROTECTED] wrote: I am using ajax to post a form that has an image upload input field. I tried getting the value as I do with other inputs, but it does not seem to work, and returns undefined: var imageUpload = $(#image_0).val(); input type=file name=image_0 class=sq-form-field / Am I missing something here?
[jQuery] Re: [Validation] Validate differently based on different action
Jacky See schrieb: [...] Any better way to do this? Or I should not use validation plugin under this situation? The plugin is certainly not the best fit for this kind of validation. You could try to implement your own plugin, reusing parts of the validation plugin, especially validation methods. You can access everything from $.validator and $.validator.prototype for that. Jörn
[jQuery] Re: [Validation]How to make two field check output one message?
Jacky schrieb: I see... the group's key is not related to the rules/method. So the group would force the underlying fields to only display one message? This would be a problem because a field would also have its own message (like date format is incorrect). I tried my old demo, inputting all four fields with wrong date format and only two comes out. With that approach you could just as well check that the to-date is greate then the from-date and display the message only for the from date - or the other way round. There isn't much of a point in merging messages for those two fields for just one validation rule. If that doesn't work for you I'd need a bit of inspiration on how to implement it. No idea currently. Jörn
[jQuery] Re: Make Readonly input text
instead of making it readonly, i try to disabled it function makeReadOnly(a) { if ($(a:contains('disabled'))) { $(a).attr(disabled,disabled); } else { $(a).removeAttr(disabled,disabled); } } If i check the checkbox, the input text become disabled, but when i checked it again, it won't be normal again. anything wrong? On Apr 23, 12:10 am, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Use the attr function On Apr 22, 3:19 pm, Andri [EMAIL PROTECTED] wrote: Hi, I'm newbie here there is two input form, checkbox and text. i want if I checked the chekbox, the input text will become readonly, and if i checked again, the input text back to normal. I'm trying make this function function makeReadOnly(a) { if ($(a:contains('readonly'))) { $(readonly = 'readonly').replaceWith( ); } else { $(a).append(readonly = 'readonly'); } } but its not working. firebug says that replaceWith is not a function. anybody can help me out?
[jQuery] Re: New and Learning JQuery
Thanks Wizz, I'll try that out too. On Apr 22, 9:13 am, Wizz [EMAIL PROTECTED] wrote: And just to point something out... Duplicate id's are never good on a page... I think you're better off by setting either the 'name' or the 'class' attribute of the hidden input. A page will never pass validation if it has duplicate id's on it and some of your javascript my freak out. Greetz, Wizz On Apr 22, 1:44 pm, binro01 [EMAIL PROTECTED] wrote: Thanks Shawn! This explanation of (this) helped me a great deal! And helped my application! Rob On Apr 22, 5:33 am, Shawn [EMAIL PROTECTED] wrote: I *think* you are after something like this: script type=text/javascript $(.stripeMe tr).click(function() { var MyVal = $(#LNAME, this).val(); javascript:location.href='test.htmlMyval=' + MyVal; }); /script having a line that says $this(); doesn't really do anything, if it doesn't outright cause an error. this in JavaScript is always context sensitive and normally refers to the object that triggered an event, or the call to the function. (this is a gross simplification, but). With that in mind, each time your click function gets executed, this will refer to the .stripeMe tr object that initiated the click. Now, there are a bunch of ways to use this. And for what you are after, there are a number of different approaches. The sample I provided above says find all objects with an id of #LNAME relative to the 'this' object. In terms of the DOM, only objects that are a child, or grandchild of the object represented by 'this' will be found (if any). You could change this to avoid the context bit with something like $(this).find(#LNAME).val() Whatever works best for you, and that you understand. Hope that helps. Shawn binro01 wrote: I been going through JQuery to add it to my knowledge base so I can integrate some of its functionality to our new web 2.0 UI for our applications which use to reside in RPG on IBM system i. I have created is a zebra list that I want to click on the list to help build the next page. There is a hidden element in the tr that is highlighted that I need the value of to build the URL for the next page. Im trying to use a this() that is then chained to get the value of that element, but Im having no luck. Any help will be appreciated. my jQuery looks like: script type=text/javascript $(document).ready(function(){ $(.stripeMe tr).click(function() { $this(); var MyVal = $(#LNAME).val(); javascript:location.href='test.htmlMyval=' + MyVal; }); $(.stripeMe tr).mouseover(function() {$ (this).addClass(over);}).mouseout(function() {$ (this).removeClass(over);}); $('.stripeMe tr:even').addClass('alt'); }); /script The HTML Looks like: table thead tr thLorem/th thIpsum/th thDolor/th thSit/th thAmet/th /tr /thead tbody class=stripeMe tr tdLorem/td tdIpsuminput type=hidden id=LNAME value=Ipsum1/td tdDolor/td tdSit/td tdAmet/td /tr tr ... So On and so forth with the same format as above Once again, once the user clicks a row tr I need to get the LNAME hidden element's value to build the URL that I will redirect the user to. Thanks in advance! Rob- Hide quoted text - - Show quoted text -
[jQuery] My jquery-powered project:
Hi guys, I just wanted to show off my new project realised with jquery: http://www.tubesearch.de What do you think?? Any suggestions regarding improvements, design or handling??
[jQuery] Re: [treeview] Mix of sync and asynced tree.
dbruensicke schrieb: Hi, i am using Jörns TreeView Plugin (http://bassistance.de/jquery-plugins/ jquery-plugin-treeview/). I try to use the async version of it, because i need lazy loading (more than 9000 elements) but i want to render the starting ul with the following elements: root + folder one + folder two - current folder (open) - element one - element two - element three (current) + folder fourth So, when i click on one of the other folders, i set a JSON call, but not before. The current implementation is, that you have an empty ul id=tree/ul and it gets populated on page-load with a JSON-Call for all elements under root. Background: It is important not to load the whole tree, but the current position right away without using JSON. I tried several ways but it did not work out. Can anyone help me with this, please? I just commited a patch that fixes a related issue and added an example showing this mix-scenario: http://dev.jquery.com/changeset/5278 Please give the latest revision a try: http://dev.jquery.com/view/trunk/plugins/treeview/ Jörn
[jQuery] Re: searching css id
Try doing if ( $('#specialSection').length ) in your conditional. -- Josh - Original Message - From: Sharique [EMAIL PROTECTED] To: jQuery (English) jquery-en@googlegroups.com Sent: Tuesday, April 22, 2008 12:22 PM Subject: [jQuery] searching css id Hi, What I'm trying to is that when there is certain css id appears in area. then it should hide right sidebar and change the width of center area. if($('#specialSection')) { $('#sidebar-right').hide(); $('#center').css('width','760px'); } But this code is not working properly. It hides right sidebar on every page.
[jQuery] searching css id
Hi, What I'm trying to is that when there is certain css id appears in area. then it should hide right sidebar and change the width of center area. if($('#specialSection')) { $('#sidebar-right').hide(); $('#center').css('width','760px'); } But this code is not working properly. It hides right sidebar on every page.
[jQuery] flexgrid plugin
I'm looking for the flexgrid plugin that used to live at http://webplicity.net/flexigrid/. The site is down, and I really want to use it! Anyone know of a backup site or have an archive to send me?
[jQuery] Re: [Tooltip] How to implement an fadeIn and fadeout?
[EMAIL PROTECTED] schrieb: Hi! I use the tooltip from here: http://bassistance.de/jquery-plugins/jquery-plugin-tooltip/ I use Jquery 1.2.3 and wish to know how to implement an fadeIn and fadeOut into it.[...] I've commited a patch that addes a fade-option: http://dev.jquery.com/changeset/5279 In the demo under The next four links have no delay with tracking, with extra content: (http://dev.jquery.com/view/trunk/plugins/tooltip/demo/) you can see whats missing: if you hover over serveral tooltipped elements quickly, it doesn't fade in properly. Haven't found a solution for that yet. You can find the latest revision here: http://dev.jquery.com/view/trunk/plugins/tooltip/ Jörn
[jQuery] Re: Autocomplete multiple entries
dineshv schrieb: I know this is a simple question but ... In the Autocomplete multiple cities example (http://dev.jquery.com/view/trunk/plugins/ autocomplete/) how do you send the final set of chosen entries to the server ie. all the values in the input box when Get Value is clicked? [...] Thats the part where you'd have to insert your logic: $(#suggest3).result(function(event, data, formatted) { var hidden = $(this).parent().next().find(:input); hidden.val( (hidden.val() ? hidden.val() + ; : hidden.val()) + data[1]); }); The arguments to the result-callback give you the most recent selection. Via $(#suggest3).val() you'll get the complete value. Jörn
[jQuery] Re: getScript is great to add scripts dynamically, but how might you remove scripts?
Which begs the question, Why would you want to remove scripts? Once a script has been included, it should have executed, so what do you gain by removing it? - jake On Mon, Apr 21, 2008 at 6:41 PM, cfdvlpr [EMAIL PROTECTED] wrote: Is it possible to remove a script from a page dynamically?
[jQuery] Safari won't load jquery.js
I'm looking into porting my current ad-hoc javascript solution to jQuery. I added a little bit of jQuery to the project and it works just fine on IE, Firefox, and Opera, but when I tried it on Safari the file seems to not load. When I look into the web inspector jquery.js has a long gray bar next to it. I tried adding all of the existing javascript files and jQuery into a test page, with a little jQuery script on it, and it worked fine, so it doesn't seem to be a javascript conflict. The project uses ASP.NET for server side logic. Is there problems that need to be worked around when using jQuery + ASP.NET + Safari? -- View this message in context: http://www.nabble.com/Safari-won%27t-load-jquery.js-tp16825838s27240p16825838.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Info about tablesorting plugin
Hi, how can I 'select' the sorting 'factor'? For example: I have a cell that contains this markup: 28-09-2007, 08:41:09 ambr / by a href=#patrick91/a now I need to sort the table by the date 28-09-2007, 08:41:09 am but I don't how to do it, can you help me? Ps. Sorry if my english is hateful but I'm still learning it :) thanks :)
[jQuery] event question
I have a click even that I add to a certain class when the page is created. There is the possibility of dynamically adding another element with that class, and I would like to have the same click even added. I'm just wondering what would happen if I registered the click event for that class, would that work? For instance: At page creation, this is run: $('.classname').click(function() { ... }); If I ran this after a new element with that class was created, would that screw anything up. I do have an id associated with the element, so I could just add the event that way. I just wasn't sure if there might be a better way, or if I could add that to a function, and just call it when needed.
[jQuery] Re: event question
The default behavior: $(.classname).click(function(){ alert(Hello, world!); }); $(body).append('span class=classnameClick Me!/span'); Clicking Click Me! would do nothing. Using the liveQuery plugin (http://brandonaaron.net/docs/livequery/): $(.classname).livequery(click, function(event) { alert(Hello, world!); }); $(body).append('span class=classnameClick Me!/span'); Clicking Click Me! should now produce an alert window. - jake On Tue, Apr 22, 2008 at 4:45 PM, Brian Ronk [EMAIL PROTECTED] wrote: I have a click even that I add to a certain class when the page is created. There is the possibility of dynamically adding another element with that class, and I would like to have the same click even added. I'm just wondering what would happen if I registered the click event for that class, would that work? For instance: At page creation, this is run: $('.classname').click(function() { ... }); If I ran this after a new element with that class was created, would that screw anything up. I do have an id associated with the element, so I could just add the event that way. I just wasn't sure if there might be a better way, or if I could add that to a function, and just call it when needed.
[jQuery] Re: searching css id
Because this wasn't immediately obvious to me when I started out, here is why: The jQuery selector will always return an object. Eg: typeof($(#doesntExist)) == object. That means if( $(#doesntExist) ) will evaluate true. This is intentional - ie, if you do something like this: $(#doesntExist).hide() you won't get nasty js errors. Cheers, Hamish On Apr 23, 7:29 am, Josh Nathanson [EMAIL PROTECTED] wrote: Try doing if ( $('#specialSection').length ) in your conditional. -- Josh - Original Message - From: Sharique [EMAIL PROTECTED] To: jQuery (English) jquery-en@googlegroups.com Sent: Tuesday, April 22, 2008 12:22 PM Subject: [jQuery] searching css id Hi, What I'm trying to is that when there is certain css id appears in area. then it should hide right sidebar and change the width of center area. if($('#specialSection')) { $('#sidebar-right').hide(); $('#center').css('width','760px'); } But this code is not working properly. It hides right sidebar on every page.- Hide quoted text - - Show quoted text -
[jQuery] Re: flexgrid plugin
Flexigrid is so good that creator site reach his bandwidth limit. Paulo Marinas, please change your bandwidth size. ;-) Cheers Marco Antonio On 4/22/08, bryanl [EMAIL PROTECTED] wrote: I'm looking for the flexgrid plugin that used to live at http://webplicity.net/flexigrid/. The site is down, and I really want to use it! Anyone know of a backup site or have an archive to send me?
[jQuery] Ajax Replacing HTML Using JSON
I'm having a strange problem using $.ajax. Better to illustrate with the code: function ajaxBind(trigger) { trigger.click(function(){ $.ajax({ type: POST, url: $(this).attr('href'), data: { 'authenticity_token': $ ('input[name=authenticity_token]').val() }, dataType: 'json', beforeSend: function(xhr) { xhr.setRequestHeader(Accept, application/json); }, // json contains id and partial keys success: function(json) { $('#task' + json['task']).html(json['partial']); } }); return false; }); } When the DOM element trigger is clicked, a request to the server is issued and the JSON response comes back. Hokey, dokey. The response is an html link. Something along the lines of: partial: link in html that google would strip out anyway This gets inserted using the html() function, as you see in the success: part of the $.ajax call, and all is well until I click on the new link. Then the link is interpreted as a request to open a document of type application/json. Firebug doesn't reveal anything unusual about the inserted HTML. Does anyone see the problem here? Thanks
[jQuery] Re: Im having trouble with selectors
Oh my gosh, I know better than that. What was I thinking. Ok, I will try some alternative method. Thanks for pointing that out. I do appreciate it. If I can not figure my problem out I will repost new issue. Thanks again. Cheers, Clint -- View this message in context: http://www.nabble.com/Im-having-trouble-with-selectors-tp16790638s27240p16826240.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: Cycle plugin with many image tabs
Thanks Mike. That did the trick. http://www.actionhobby.ca/index.php?q=/node/524 Also had to throw in some code to make sure the image navigation DIV was in place (add it if it wasn't). TinyMCE likes to remove empty DIVs Shawn Mike Alsup wrote: I'm using the cycle plugin and have set it up to automagically create the tabs for changing to the next image. http://www.actionhobby.ca/index.php?q=/node/524 But, this particular page has 32 images (possibly more to come). The tabs are generated in a single row, and do not wrap at the edge of the screen. So I'm looking for ideas how to resolve this. (works great on a 1650x1024 page, not so great at smaller resolutions) Can this be handled via CSS? Or am I going to be tweaking code? Give them a float:left style and then add margins, etc. Also, give the slideshow a clear:left style. Mike
[jQuery] Re: Ajax Replacing HTML Using JSON
I'm just guessing here, but I would think it would be related to your xhr.setRequestHeader line. I don't really understand why you need that anyway in this case. What happens if you completely remove the beforeSend: parameter from your $.ajax? On Apr 22, 3:51 pm, s.ross [EMAIL PROTECTED] wrote: I'm having a strange problem using $.ajax. Better to illustrate with the code: function ajaxBind(trigger) { trigger.click(function(){ $.ajax({ type: POST, url: $(this).attr('href'), data: { 'authenticity_token': $ ('input[name=authenticity_token]').val() }, dataType: 'json', beforeSend: function(xhr) { xhr.setRequestHeader(Accept, application/json); }, // json contains id and partial keys success: function(json) { $('#task' + json['task']).html(json['partial']); } }); return false; }); } When the DOM element trigger is clicked, a request to the server is issued and the JSON response comes back. Hokey, dokey. The response is an html link. Something along the lines of: partial: link in html that google would strip out anyway This gets inserted using the html() function, as you see in the success: part of the $.ajax call, and all is well until I click on the new link. Then the link is interpreted as a request to open a document of type application/json. Firebug doesn't reveal anything unusual about the inserted HTML. Does anyone see the problem here? Thanks
[jQuery] Re: Help with fadeIn / fadeOut
[EMAIL PROTECTED] schrieb: Hi, If you look at this page http://elearningrd.info/jrl/policies.php and click on each of the links next to the arrow graphics, you'll see the center text switches out. However, it is choppy. It seems that as one div is fading out, the other is fading in at the same time. This is the code I'm using function swapDivs(oldDivId, newDivId) { $(# + oldDivId).fadeOut(slow); $(# + newDivId).fadeIn(slow); } // swapDivs How can I make one div fade in only after the other div has completly faded out? You have to chain those animations via callbacks: $(# + oldDivId).fadeOut(slow, function() { $(# + newDivId).fadeIn(slow); }); See http://docs.jquery.com/Effects Jörn
[jQuery] Why is form submit action not being invoked?
Hi, When I submit the contact form http://elearningrd.info/jrl/contact.php I would like to validate the email address and possibly check non- empty values for the other fields. I'm using this code to try and check things upon form submission: $(document).ready(function() { $('#msgForm').submit(function() { var email = $('#Email').val(); if (!validateForm(email)) { alert(Invalid email format.); return false; } return true; }); }); but the form validation doesn't seem to be invoked. Any ideas why? Thanks, - Dave
[jQuery] Re: Why is form submit action not being invoked?
Check the form plugin. May be of some use. Also, I'm no expert, but is passing a jquery object to validateForm function causing an issue? http://www.malsup.com/jquery/form/#getting-started Joe www.subprint.com On Apr 22, 4:57 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi, When I submit the contact form http://elearningrd.info/jrl/contact.php I would like to validate the email address and possibly check non- empty values for the other fields. I'm using this code to try and check things upon form submission: $(document).ready(function() { $('#msgForm').submit(function() { var email = $('#Email').val(); if (!validateForm(email)) { alert(Invalid email format.); return false; } return true; }); }); but the form validation doesn't seem to be invoked. Any ideas why? Thanks, - Dave
[jQuery] Re: Help with fadeIn / fadeOut
This should do it. function swapDivs(oldDivId, newDivId) { $(# + oldDivId).fadeOut(slow, function() { $(# + newDivId).fadeIn(slow); } // swapDivs ); [EMAIL PROTECTED] wrote: Hi, If you look at this page http://elearningrd.info/jrl/policies.php and click on each of the links next to the arrow graphics, you'll see the center text switches out. However, it is choppy. It seems that as one div is fading out, the other is fading in at the same time. This is the code I'm using function swapDivs(oldDivId, newDivId) { $(# + oldDivId).fadeOut(slow); $(# + newDivId).fadeIn(slow); } // swapDivs How can I make one div fade in only after the other div has completly faded out? Thanks, - Dave
[jQuery] Re: Help with fadeIn / fadeOut
You have to use a callback: $(a).click(function () {$(div).fadeIn(3000, function () { $(div).fadeOut(100);});return false; }); Look it up in the jQuery documentation. It's quite simple to use. http://2whoa.com/dominate/ [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi, If you look at this page http://elearningrd.info/jrl/policies.php and click on each of the links next to the arrow graphics, you'll see the center text switches out. However, it is choppy. It seems that as one div is fading out, the other is fading in at the same time. This is the code I'm using function swapDivs(oldDivId, newDivId) { $(# + oldDivId).fadeOut(slow); $(# + newDivId).fadeIn(slow); } // swapDivs How can I make one div fade in only after the other div has completly faded out? Thanks, - Dave - Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now.
[jQuery] Re: [validate] value is trimmed before getting to validation function
Thank you very much!!! On Apr 22, 1:27 pm, Jörn Zaefferer [EMAIL PROTECTED] wrote: sebastian schrieb: Hi, i'm developing a costum validation method for a password field, the password must not contain spaces. I thought my method worked fine until during a test i put a space at the end of the password, my method returned that the password was correct, and i noticed that the problem was that the value of the field is trimmed before it is sent to the validation method. And I thought it might be a good idea not to trim the values before they are sent to the validation methods, what do you think? Instead of using the trimmed value in your method, use the second argument, which points to the element itself, and get the value from there, via element.value Jörn
[jQuery] Re: [validate] validation doesn't work for radio buttons associated with hidden field
Thank you very much for your answer!!! On Apr 22, 1:31 pm, Jörn Zaefferer [EMAIL PROTECTED] wrote: sebastian schrieb: Hi, the problem i have is that I have a group of radio buttons associated with a hidden field like this: input type=hidden name=data[User][gender] value= id=UserGender_ / input type=radio name=data[User][gender] id=UserGenderF value=f / label for=UserGenderFFemale/label input type=radio name=data[User][gender] id=UserGenderM value=m / label for=UserGenderMMale/label and I have the following validation rule for the element: data[User][gender]:required the validation doesn't work , it always shows an error whether the radio buttons are selected or not. Please help. The required-method doesn't support mixed types. In your setup, only the hidden field is validated, which is always invalid. You could implement a custom required-method for this case. Take a look at the current required-implementation for reference validating the group of radio buttons. Jörn
[jQuery] Re: Make Readonly input text
Try using this code instead: function makeReadOnly(a) { if ($(a:contains('disabled'))) { $(a).attr(disabled,disabled); } else { $(a).removeAttr(disabled); } } On Apr 22, 7:37 pm, Andri [EMAIL PROTECTED] wrote: instead of making it readonly, i try to disabled it function makeReadOnly(a) { if ($(a:contains('disabled'))) { $(a).attr(disabled,disabled); } else { $(a).removeAttr(disabled,disabled); } } If i check the checkbox, the input text become disabled, but when i checked it again, it won't be normal again. anything wrong? On Apr 23, 12:10 am, [EMAIL PROTECTED][EMAIL PROTECTED] wrote: Use the attr function On Apr 22, 3:19 pm, Andri [EMAIL PROTECTED] wrote: Hi, I'm newbie here there is two input form, checkbox and text. i want if I checked the chekbox, the input text will become readonly, and if i checked again, the input text back to normal. I'm trying make this function function makeReadOnly(a) { if ($(a:contains('readonly'))) { $(readonly = 'readonly').replaceWith( ); } else { $(a).append(readonly = 'readonly'); } } but its not working. firebug says that replaceWith is not a function. anybody can help me out?
[jQuery] TableSorter 2.0 - jQuery.noConflict() breaks Tablesorter appendCache in Firefox
Hi, I'm using TableSorter 2.0 with the pager plugin, and then appending table rows. This works fine when run without prototype.js, when run with prototype.js (but jQuery then breaks our prototype calls), and always works in IE 6. We had to add jQuery.noConflict() to the top of our script, and then change all of our $ references to jQuery. Adding function($) to our document.ready did nothing in particular to solve this after we changed our references. However in Firefox 2, I get an error on line 681 of tablesorter.js, which is: table.tBodies[0].innerHTML = ; The error in Firebug is that table.tBodies[0] has no properties In our code, the flow is that an AJAX call is made which gets back some table rows (as variable html), and then appends them to the table: jQuery(#demotable).tablesorterPager({size: config.totalRows}); jQuery(#demotable tbody).append(html); jQuery(#demotable).trigger(update); jQuery(#demotable).trigger(appendCache); The error is coming from tablesorter's pager - renderTable works fine when it is called three times, and then somewhere the table never gets anything appended back to it, renderTable gets called, and clearTableBody in tablesorter.js breaks. Hopefully this rings a bell for somebody. I'm still digging into tablesorter and jQuery to see if I can figure out what is going on myself. Thanks, Jeff Linwood
[jQuery] Re: Make Readonly input text
still doesn't work :( can't go back to normal On Apr 23, 5:19 am, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Try using this code instead: function makeReadOnly(a) { if ($(a:contains('disabled'))) { $(a).attr(disabled,disabled); } else { $(a).removeAttr(disabled); } } On Apr 22, 7:37 pm, Andri [EMAIL PROTECTED] wrote: instead of making it readonly, i try to disabled it function makeReadOnly(a) { if ($(a:contains('disabled'))) { $(a).attr(disabled,disabled); } else { $(a).removeAttr(disabled,disabled); } } If i check the checkbox, the input text become disabled, but when i checked it again, it won't be normal again. anything wrong? On Apr 23, 12:10 am, [EMAIL PROTECTED][EMAIL PROTECTED] wrote: Use the attr function On Apr 22, 3:19 pm, Andri [EMAIL PROTECTED] wrote: Hi, I'm newbie here there is two input form, checkbox and text. i want if I checked the chekbox, the input text will become readonly, and if i checked again, the input text back to normal. I'm trying make this function function makeReadOnly(a) { if ($(a:contains('readonly'))) { $(readonly = 'readonly').replaceWith( ); } else { $(a).append(readonly = 'readonly'); } } but its not working. firebug says that replaceWith is not a function. anybody can help me out?
[jQuery] Re: Make Readonly input text
To change disabled or readonly you can use boolean values (true and false) and the attr() function. So if a is a jQuery selected text box (or a checkbox or any other form input), you can write: // Disable a a.attr('disabled', true); // Enable a a.attr('disabled', false); // Make a read-only a.attr('readonly', true); // Make a not read-only a.attr('readonly', false); Karl Rudd On Wed, Apr 23, 2008 at 12:19 AM, Andri [EMAIL PROTECTED] wrote: Hi, I'm newbie here there is two input form, checkbox and text. i want if I checked the chekbox, the input text will become readonly, and if i checked again, the input text back to normal. I'm trying make this function function makeReadOnly(a) { if ($(a:contains('readonly'))) { $(readonly = 'readonly').replaceWith( ); } else { $(a).append(readonly = 'readonly'); } } but its not working. firebug says that replaceWith is not a function. anybody can help me out?
[jQuery] Re: Make Readonly input text
even i changed the code become function makeReadOnly(a) { if ($(a:contains('disabled'))) { $(a).attr(disabled,true); } else { $(a).attr(disabled,false); } } it don't go back to normal after i clear the check On Apr 23, 7:09 am, Karl Rudd [EMAIL PROTECTED] wrote: To change disabled or readonly you can use boolean values (true and false) and the attr() function. So if a is a jQuery selected text box (or a checkbox or any other form input), you can write: // Disable a a.attr('disabled', true); // Enable a a.attr('disabled', false); // Make a read-only a.attr('readonly', true); // Make a not read-only a.attr('readonly', false); Karl Rudd On Wed, Apr 23, 2008 at 12:19 AM, Andri [EMAIL PROTECTED] wrote: Hi, I'm newbie here there is two input form, checkbox and text. i want if I checked the chekbox, the input text will become readonly, and if i checked again, the input text back to normal. I'm trying make this function function makeReadOnly(a) { if ($(a:contains('readonly'))) { $(readonly = 'readonly').replaceWith( ); } else { $(a).append(readonly = 'readonly'); } } but its not working. firebug says that replaceWith is not a function. anybody can help me out?
[jQuery] Re: Make Readonly input text
What is the HTML you are using? You are doing something strange. The code $(a:contains('disabled')) means: Select all a elements (links) that have the text disabled in the text. For example: a href=blahThis has disabled in it and so will be selected/a The code $(a:contains('disabled')) also _always_ returns an object, so will it _always_ run the $(a).attr(disabled,true); and not the $(a).attr(disabled,false); Are you trying to do something like this?: HTML: labelinput type=checkbox id=myCheckbox Disable Text Box/label input type=text id=myTextBox JavaScript: $(document).ready(funtion() { $('#myCheckbox').click( function() { // Disable myTextBox when myCheckbox is checked $('#myTextBox').attr('disabled', this.checked); } }); Karl Rudd On Wed, Apr 23, 2008 at 10:27 AM, Andri [EMAIL PROTECTED] wrote: even i changed the code become function makeReadOnly(a) { if ($(a:contains('disabled'))) { $(a).attr(disabled,true); } else { $(a).attr(disabled,false); } } it don't go back to normal after i clear the check On Apr 23, 7:09 am, Karl Rudd [EMAIL PROTECTED] wrote: To change disabled or readonly you can use boolean values (true and false) and the attr() function. So if a is a jQuery selected text box (or a checkbox or any other form input), you can write: // Disable a a.attr('disabled', true); // Enable a a.attr('disabled', false); // Make a read-only a.attr('readonly', true); // Make a not read-only a.attr('readonly', false); Karl Rudd On Wed, Apr 23, 2008 at 12:19 AM, Andri [EMAIL PROTECTED] wrote: Hi, I'm newbie here there is two input form, checkbox and text. i want if I checked the chekbox, the input text will become readonly, and if i checked again, the input text back to normal. I'm trying make this function function makeReadOnly(a) { if ($(a:contains('readonly'))) { $(readonly = 'readonly').replaceWith( ); } else { $(a).append(readonly = 'readonly'); } } but its not working. firebug says that replaceWith is not a function. anybody can help me out?
[jQuery] Re: Make Readonly input text
Mistake in my JavaScript code, should be: $(document).ready(funtion() { $('#myCheckbox').click( function() { // Disable myTextBox when myCheckbox is checked $('#myTextBox').attr('disabled', this.checked); }); }); Karl Rudd On Wed, Apr 23, 2008 at 10:42 AM, Karl Rudd [EMAIL PROTECTED] wrote: What is the HTML you are using? You are doing something strange. The code $(a:contains('disabled')) means: Select all a elements (links) that have the text disabled in the text. For example: a href=blahThis has disabled in it and so will be selected/a The code $(a:contains('disabled')) also _always_ returns an object, so will it _always_ run the $(a).attr(disabled,true); and not the $(a).attr(disabled,false); Are you trying to do something like this?: HTML: labelinput type=checkbox id=myCheckbox Disable Text Box/label input type=text id=myTextBox JavaScript: $(document).ready(funtion() { $('#myCheckbox').click( function() { // Disable myTextBox when myCheckbox is checked $('#myTextBox').attr('disabled', this.checked); } }); Karl Rudd On Wed, Apr 23, 2008 at 10:27 AM, Andri [EMAIL PROTECTED] wrote: even i changed the code become function makeReadOnly(a) { if ($(a:contains('disabled'))) { $(a).attr(disabled,true); } else { $(a).attr(disabled,false); } } it don't go back to normal after i clear the check On Apr 23, 7:09 am, Karl Rudd [EMAIL PROTECTED] wrote: To change disabled or readonly you can use boolean values (true and false) and the attr() function. So if a is a jQuery selected text box (or a checkbox or any other form input), you can write: // Disable a a.attr('disabled', true); // Enable a a.attr('disabled', false); // Make a read-only a.attr('readonly', true); // Make a not read-only a.attr('readonly', false); Karl Rudd On Wed, Apr 23, 2008 at 12:19 AM, Andri [EMAIL PROTECTED] wrote: Hi, I'm newbie here there is two input form, checkbox and text. i want if I checked the chekbox, the input text will become readonly, and if i checked again, the input text back to normal. I'm trying make this function function makeReadOnly(a) { if ($(a:contains('readonly'))) { $(readonly = 'readonly').replaceWith( ); } else { $(a).append(readonly = 'readonly'); } } but its not working. firebug says that replaceWith is not a function. anybody can help me out?
[jQuery] Re: Make Readonly input text
I'm have checkbox and input text like this input type=checkbox name=f1corporation value=1 onclick=makeReadOnly('#f1corporationstate');/ Corporation input name=f1corporationstate id=f1corporationstate size=5 type=text / I want, if I check the f1corporation, the f1corporationstate will enabled and when I uncheck the f1corporation, it will become disabled On Apr 23, 1:43 am, Karl Rudd [EMAIL PROTECTED] wrote: Mistake in my JavaScript code, should be: $(document).ready(funtion() { $('#myCheckbox').click( function() { // Disable myTextBox when myCheckbox is checked $('#myTextBox').attr('disabled', this.checked); }); }); Karl Rudd On Wed, Apr 23, 2008 at 10:42 AM, Karl Rudd [EMAIL PROTECTED] wrote: What is the HTML you are using? You are doing something strange. The code $(a:contains('disabled')) means: Select all a elements (links) that have the text disabled in the text. For example: a href=blahThis has disabled in it and so will be selected/a The code $(a:contains('disabled')) also _always_ returns an object, so will it _always_ run the $(a).attr(disabled,true); and not the $(a).attr(disabled,false); Are you trying to do something like this?: HTML: labelinput type=checkbox id=myCheckbox Disable Text Box/label input type=text id=myTextBox JavaScript: $(document).ready(funtion() { $('#myCheckbox').click( function() { // Disable myTextBox when myCheckbox is checked $('#myTextBox').attr('disabled', this.checked); } }); Karl Rudd On Wed, Apr 23, 2008 at 10:27 AM, Andri [EMAIL PROTECTED] wrote: even i changed the code become function makeReadOnly(a) { if ($(a:contains('disabled'))) { $(a).attr(disabled,true); } else { $(a).attr(disabled,false); } } it don't go back to normal after i clear the check On Apr 23, 7:09 am, Karl Rudd [EMAIL PROTECTED] wrote: To change disabled or readonly you can use boolean values (true and false) and the attr() function. So if a is a jQuery selected text box (or a checkbox or any other form input), you can write: // Disable a a.attr('disabled', true); // Enable a a.attr('disabled', false); // Make a read-only a.attr('readonly', true); // Make a not read-only a.attr('readonly', false); Karl Rudd On Wed, Apr 23, 2008 at 12:19 AM, Andri [EMAIL PROTECTED] wrote: Hi, I'm newbie here there is two input form, checkbox and text. i want if I checked the chekbox, the input text will become readonly, and if i checked again, the input text back to normal. I'm trying make this function function makeReadOnly(a) { if ($(a:contains('readonly'))) { $(readonly = 'readonly').replaceWith( ); } else { $(a).append(readonly = 'readonly'); } } but its not working. firebug says that replaceWith is not a function. anybody can help me out?
[jQuery] Re: Make Readonly input text
Ok first the intrusive version (that is with the onclick handler directly in the HTML code) which I really don't recommend: label input type=checkbox name=f1corporation value=1 onclick=changeState('#f1corporationstate', this.checked) / Corporation /label input name=f1corporationstate id=f1corporationstate size=5 type=text / function changeState(id, enable) { $(id).attr('disabled', !enable); } Now the unintrusive version (which I recommend): label input type=checkbox name=f1corporation value=1 class=corpState / Corporation /label input name=f1corporationstate id=f1corporationstate size=5 type=text / $(function() { function updateState() { $('#' + this.name + 'state').attr('disabled', this.checked ); } $(':checkbox.corpState') .each( updateState ) .bind('click', updateState) }); The advantage of the unintrusive version is that it makes for a lot cleaner HTML and you can use it with multiple checkbox / textbox pairs, for instance: label input type=checkbox name=f1corporation value=1 class=corpState / Corporation /label input name=f1corporationstate id=f1corporationstate size=5 type=text / label input type=checkbox name=f2corporation value=1 class=corpState / Corporation /label input name=f1corporationstate id=f2corporationstate size=5 type=text / label input type=checkbox name=somethingcorp value=1 class=corpState / Corporation /label input name=somethingcorpstate id=somethingcorpstate size=5 type=text / The naming just has to remain consistent: - the checkbox has to have a class of 'corpState' - the textbox id = checkbox.name + 'state' Karl Rudd On Wed, Apr 23, 2008 at 2:58 PM, Andri [EMAIL PROTECTED] wrote: I'm have checkbox and input text like this input type=checkbox name=f1corporation value=1 onclick=makeReadOnly('#f1corporationstate');/ Corporation input name=f1corporationstate id=f1corporationstate size=5 type=text / I want, if I check the f1corporation, the f1corporationstate will enabled and when I uncheck the f1corporation, it will become disabled On Apr 23, 1:43 am, Karl Rudd [EMAIL PROTECTED] wrote: Mistake in my JavaScript code, should be: $(document).ready(funtion() { $('#myCheckbox').click( function() { // Disable myTextBox when myCheckbox is checked $('#myTextBox').attr('disabled', this.checked); }); }); Karl Rudd On Wed, Apr 23, 2008 at 10:42 AM, Karl Rudd [EMAIL PROTECTED] wrote: What is the HTML you are using? You are doing something strange. The code $(a:contains('disabled')) means: Select all a elements (links) that have the text disabled in the text. For example: a href=blahThis has disabled in it and so will be selected/a The code $(a:contains('disabled')) also _always_ returns an object, so will it _always_ run the $(a).attr(disabled,true); and not the $(a).attr(disabled,false); Are you trying to do something like this?: HTML: labelinput type=checkbox id=myCheckbox Disable Text Box/label input type=text id=myTextBox JavaScript: $(document).ready(funtion() { $('#myCheckbox').click( function() { // Disable myTextBox when myCheckbox is checked $('#myTextBox').attr('disabled', this.checked); } }); Karl Rudd On Wed, Apr 23, 2008 at 10:27 AM, Andri [EMAIL PROTECTED] wrote: even i changed the code become function makeReadOnly(a) { if ($(a:contains('disabled'))) { $(a).attr(disabled,true); } else { $(a).attr(disabled,false); } } it don't go back to normal after i clear the check On Apr 23, 7:09 am, Karl Rudd [EMAIL PROTECTED] wrote: To change disabled or readonly you can use boolean values (true and false) and the attr() function. So if a is a jQuery selected text box (or a checkbox or any other form input), you can write: // Disable a a.attr('disabled', true); // Enable a a.attr('disabled', false); // Make a read-only a.attr('readonly', true); // Make a not read-only a.attr('readonly', false); Karl Rudd On Wed, Apr 23, 2008 at 12:19 AM, Andri [EMAIL PROTECTED] wrote: Hi, I'm newbie here there is two input form, checkbox and text. i want if I checked the chekbox, the input text will become readonly, and if i checked again, the input text back to normal. I'm trying make this function function makeReadOnly(a) { if ($(a:contains('readonly'))) {