[jQuery] Remove JS if statement from other script
How possible is it to remove ONLY part of a script, specifically an if statement from another script? We have a script that is in the header of our document, and it screws up a few of our pages, so I don't want to delete it, since it is needed for some pages, but for specific pages, I would like it to not execute the if statement. Is this possible?
[jQuery] Using .fadeOut() then .html()
I have some text that is in a div that I would like to fade out, then I want to clear the HTML of that div. But, it seems that the fadeOut doesn't get run before the HTML gets cleared: setTimeout(function() { $(#ajaxResult).fadeOut(slow).html(); }, 5000); Did I do something wrong here?
[jQuery] Re: Using .fadeOut() then .html()
Perfect, thank you!! On Oct 7, 11:19 am, MorningZ [EMAIL PROTECTED] wrote: Use the callback of the fadeOut event http://docs.jquery.com/Effects/fadeOut#speedcallback $(#ajaxResult).fadeOut(slow, function() { $(this).html() }); On Oct 7, 2:08 pm, hubbs [EMAIL PROTECTED] wrote: I have some text that is in a div that I would like to fade out, then I want to clear the HTML of that div. But, it seems that the fadeOut doesn't get run before the HTML gets cleared: setTimeout(function() { $(#ajaxResult).fadeOut(slow).html(); }, 5000); Did I do something wrong here?
[jQuery] Is .prev() being used in the wrong way here?
I have a function that filters a listed based on the value of an input field. The .each() function looks at inside each anchor tag, and adds a new class if there is a match. But, I want the class to be added to the parent, or prev element here, which is a holder div called itemHolder. For some reason it is not even adding the hidden class to the previous element, which should be the itemHolder div. Am I using this in the wrong way? Using .parent() does not work either. $(#filter).keyup(function() { var filter = $(this).val(), count = 0; $(.scroll a).each(function() { if ($(this).text().search(new RegExp(filter, i)) 0) { $(this).prev(.itemHolder).addClass(hidden); } else { $(this).prev(.itemHolder).removeClass(hidden); count++; } }); });
[jQuery] Re: Is .prev() being used in the wrong way here?
The .itemHolder element should get the hidden class. I tried using .parent() instead, and it worked perfectly. Thanks! On Oct 7, 2:34 pm, Dave Methvin [EMAIL PROTECTED] wrote: But, I want the class to be added to the parent, or prev element here, which is a holder div called itemHolder. So which element should get the hidden class? .prev() selects the previous sibling. It sounds like you may want .parent() instead.
[jQuery] Confirm, then change back value
I am trying to change a select list, and if the user sets it to No, then a confirm dialog comes up, if they hit cancel, the value will get set back to Yes. For some reason it is not working: $(#metadata_field_text_33100_value).change(function() { var confirmWeb = confirm(Are you sure that you don't want this Announcement to be posted on the website?); if ($(this).val() == No || confirmWeb) { return true; } else { $(#metadata_field_text_33100_value).val(Yes); } });
[jQuery] Re: Bind events on DOM elements inserted from other frame
Well, I tried this, but again it is not working, I really must be missing something. All I want to do it be able to click the link inside the iframe, and have it append some HTML into the parent, and apply a click event as well, that is all, seems simple! :) My test page: http://web2.puc.edu/PUC/files/bind.html Iframe page: http://web2.puc.edu/PUC/files/iframe.html Thanks for all the help. On Sep 24, 3:02 pm, ricardobeat [EMAIL PROTECTED] wrote: Hi, This works for me (FF3) (code running in the parent frame): $('#test',frames[0].document).click(function(){ //bind function to event from element *inside iframe* $('bTESTE/b').appendTo('body').click(function(){ // append element to the *parent frame* and assing a click handler to it alert('test'); }); }); I might not be understanding clearly what you want, a test case or explanation of the functionality you are looking for might help. cheers, - ricardo On Sep 24, 1:27 pm, hubbs [EMAIL PROTECTED] wrote: Hi Ricardo, I am not appending an iframe, it is hardcoded. I am trying to append to the parent document from within the iframe, and have the event in the parent bound to the appended element from the iframe. On Sep 23, 11:49 pm, ricardobeat [EMAIL PROTECTED] wrote: Hi, I can't test anything right now, but are you setting up the ready() function after appending the iframe? On Sep 23, 9:11 pm, hubbs [EMAIL PROTECTED] wrote: Yeah, this really is not working. Could someone please help me to understand how to make multiple frames use the same jquery instance so I can resolve this problem? Do I need to resort to frame ready plugin? I really don't want to... On Sep 17, 7:12 pm, ricardobeat [EMAIL PROTECTED] wrote: Not sure but $(frames['frame'].document).ready() should work (from the parent window). On Sep 17, 8:21 pm, hubbs [EMAIL PROTECTED] wrote: Ok, I am realizing it has to do with the do with the $(document).ready function. If I just use: $ = window.parent.$; $(#hold).append('a href=#Inserted from iFrame/a br /'); In the iframe, it correctly adds the link to the parent, and it gets the event from livequery! Hooray!! But, obviously I need to add back a document ready function so that I can bind events within the iframe. How does that need to be done in this context? As I said, using the normal document ready does not work. On Sep 17, 9:58 am, ricardobeat [EMAIL PROTECTED] wrote: using the iframe's jQuery object: $('.classinparentframe', parent.window.document) Ideally if the contents of the iframe are always known to you, you should use only one instance of jQuery on the parent window and do all your stuff from it, it's simpler to debug also. On Sep 16, 10:29 pm, hubbs [EMAIL PROTECTED] wrote: Thanks Ricardo. But what if I wanted to access the parent document from WITHIN the iframe? On Sep 16, 12:27 pm, ricardobeat [EMAIL PROTECTED] wrote: You need to understand that a frame is another 'window' instance, it doesn't have the same jQuery object as the parent window unless you tell it to. So the '$' object you use in firebug console is always the one from the parent window. If i'm not mistaken you can acess frame content with the parent window's jQuery object using $('.classinsidetheframe', frames['name'].document).css(); On Sep 16, 1:48 pm, hubbs [EMAIL PROTECTED] wrote: Ok Brandon, I found this in another post: var doc = $('#testframe')[0].contentWindow.document; $(doc.body).append('spantest/span'); This seems like it would help, but I am not sure how to use this, along with what you posted to get it working correctly. Somehow sending the GET within the context of the contentWindow is confusing me, and I just can't get it working. On Sep 15, 9:18 am, Brandon Aaron [EMAIL PROTECTED] wrote: To see what I mean run this in Firebug: $('iframe')[0].contentWindow.$ = $; Then click on the link in the iframe and it will behave as you expect. -- Brandon Aaron On Mon, Sep 15, 2008 at 9:13 AM, Brandon Aaron [EMAIL PROTECTED]wrote: This would work if you used the frames parent instance of jQuery. LiveQuery works by monitoring the DOM methods within jQuery. Since within the frame you are using a new instance of jQuery, LiveQuery will not be monitoring its DOM methods. -- Brandon Aaron On Sun, Sep 14, 2008 at 11:04 PM
[jQuery] Re: Bind events on DOM elements inserted from other frame
Hi Ricardo, I am not appending an iframe, it is hardcoded. I am trying to append to the parent document from within the iframe, and have the event in the parent bound to the appended element from the iframe. On Sep 23, 11:49 pm, ricardobeat [EMAIL PROTECTED] wrote: Hi, I can't test anything right now, but are you setting up the ready() function after appending the iframe? On Sep 23, 9:11 pm, hubbs [EMAIL PROTECTED] wrote: Yeah, this really is not working. Could someone please help me to understand how to make multiple frames use the same jquery instance so I can resolve this problem? Do I need to resort to frame ready plugin? I really don't want to... On Sep 17, 7:12 pm, ricardobeat [EMAIL PROTECTED] wrote: Not sure but $(frames['frame'].document).ready() should work (from the parent window). On Sep 17, 8:21 pm, hubbs [EMAIL PROTECTED] wrote: Ok, I am realizing it has to do with the do with the $(document).ready function. If I just use: $ = window.parent.$; $(#hold).append('a href=#Inserted from iFrame/a br /'); In the iframe, it correctly adds the link to the parent, and it gets the event from livequery! Hooray!! But, obviously I need to add back a document ready function so that I can bind events within the iframe. How does that need to be done in this context? As I said, using the normal document ready does not work. On Sep 17, 9:58 am, ricardobeat [EMAIL PROTECTED] wrote: using the iframe's jQuery object: $('.classinparentframe', parent.window.document) Ideally if the contents of the iframe are always known to you, you should use only one instance of jQuery on the parent window and do all your stuff from it, it's simpler to debug also. On Sep 16, 10:29 pm, hubbs [EMAIL PROTECTED] wrote: Thanks Ricardo. But what if I wanted to access the parent document from WITHIN the iframe? On Sep 16, 12:27 pm, ricardobeat [EMAIL PROTECTED] wrote: You need to understand that a frame is another 'window' instance, it doesn't have the same jQuery object as the parent window unless you tell it to. So the '$' object you use in firebug console is always the one from the parent window. If i'm not mistaken you can acess frame content with the parent window's jQuery object using $('.classinsidetheframe', frames['name'].document).css(); On Sep 16, 1:48 pm, hubbs [EMAIL PROTECTED] wrote: Ok Brandon, I found this in another post: var doc = $('#testframe')[0].contentWindow.document; $(doc.body).append('spantest/span'); This seems like it would help, but I am not sure how to use this, along with what you posted to get it working correctly. Somehow sending the GET within the context of the contentWindow is confusing me, and I just can't get it working. On Sep 15, 9:18 am, Brandon Aaron [EMAIL PROTECTED] wrote: To see what I mean run this in Firebug: $('iframe')[0].contentWindow.$ = $; Then click on the link in the iframe and it will behave as you expect. -- Brandon Aaron On Mon, Sep 15, 2008 at 9:13 AM, Brandon Aaron [EMAIL PROTECTED]wrote: This would work if you used the frames parent instance of jQuery. LiveQuery works by monitoring the DOM methods within jQuery. Since within the frame you are using a new instance of jQuery, LiveQuery will not be monitoring its DOM methods. -- Brandon Aaron On Sun, Sep 14, 2008 at 11:04 PM, hubbs [EMAIL PROTECTED] wrote: I can confirm that using event delegation will fix this problem. I guess that it is just a problem with the LiveQuery plugin. Brandon, if you are where around here, could you comment on this? Thanks. On Sep 14, 2:29 pm, hubbs [EMAIL PROTECTED] wrote: I have a working example of this, and would really like help understanding why bind or livequery does not bind events to DOM elements that are inserted from an iframe. http://web2.puc.edu/PUC/files/bind.html Clicking the insert from frame link will append links to the parent frame, which won't pick up the click event. But, clicking the insert from body link will append links within the same frame and will correctly have the click events bound. Why is this happening? On Sep 12, 9:02 pm, hubbs [EMAIL PROTECTED] wrote: I have been experiencing strangeness with trying tobindevents to DOM elements that have been inserted from a different
[jQuery] Re: Bind events on DOM elements inserted from other frame
Yeah, this really is not working. Could someone please help me to understand how to make multiple frames use the same jquery instance so I can resolve this problem? Do I need to resort to frame ready plugin? I really don't want to... On Sep 17, 7:12 pm, ricardobeat [EMAIL PROTECTED] wrote: Not sure but $(frames['frame'].document).ready() should work (from the parent window). On Sep 17, 8:21 pm, hubbs [EMAIL PROTECTED] wrote: Ok, I am realizing it has to do with the do with the $(document).ready function. If I just use: $ = window.parent.$; $(#hold).append('a href=#Inserted from iFrame/a br /'); In the iframe, it correctly adds the link to the parent, and it gets the event from livequery! Hooray!! But, obviously I need to add back a document ready function so that I can bind events within the iframe. How does that need to be done in this context? As I said, using the normal document ready does not work. On Sep 17, 9:58 am, ricardobeat [EMAIL PROTECTED] wrote: using the iframe's jQuery object: $('.classinparentframe', parent.window.document) Ideally if the contents of the iframe are always known to you, you should use only one instance of jQuery on the parent window and do all your stuff from it, it's simpler to debug also. On Sep 16, 10:29 pm, hubbs [EMAIL PROTECTED] wrote: Thanks Ricardo. But what if I wanted to access the parent document from WITHIN the iframe? On Sep 16, 12:27 pm, ricardobeat [EMAIL PROTECTED] wrote: You need to understand that a frame is another 'window' instance, it doesn't have the same jQuery object as the parent window unless you tell it to. So the '$' object you use in firebug console is always the one from the parent window. If i'm not mistaken you can acess frame content with the parent window's jQuery object using $('.classinsidetheframe', frames['name'].document).css(); On Sep 16, 1:48 pm, hubbs [EMAIL PROTECTED] wrote: Ok Brandon, I found this in another post: var doc = $('#testframe')[0].contentWindow.document; $(doc.body).append('spantest/span'); This seems like it would help, but I am not sure how to use this, along with what you posted to get it working correctly. Somehow sending the GET within the context of the contentWindow is confusing me, and I just can't get it working. On Sep 15, 9:18 am, Brandon Aaron [EMAIL PROTECTED] wrote: To see what I mean run this in Firebug: $('iframe')[0].contentWindow.$ = $; Then click on the link in the iframe and it will behave as you expect. -- Brandon Aaron On Mon, Sep 15, 2008 at 9:13 AM, Brandon Aaron [EMAIL PROTECTED]wrote: This would work if you used the frames parent instance of jQuery. LiveQuery works by monitoring the DOM methods within jQuery. Since within the frame you are using a new instance of jQuery, LiveQuery will not be monitoring its DOM methods. -- Brandon Aaron On Sun, Sep 14, 2008 at 11:04 PM, hubbs [EMAIL PROTECTED] wrote: I can confirm that using event delegation will fix this problem. I guess that it is just a problem with the LiveQuery plugin. Brandon, if you are where around here, could you comment on this? Thanks. On Sep 14, 2:29 pm, hubbs [EMAIL PROTECTED] wrote: I have a working example of this, and would really like help understanding why bind or livequery does not bind events to DOM elements that are inserted from an iframe. http://web2.puc.edu/PUC/files/bind.html Clicking the insert from frame link will append links to the parent frame, which won't pick up the click event. But, clicking the insert from body link will append links within the same frame and will correctly have the click events bound. Why is this happening? On Sep 12, 9:02 pm, hubbs [EMAIL PROTECTED] wrote: I have been experiencing strangeness with trying tobindevents to DOM elements that have been inserted from a different frame using .get(). For some reason the elements don't be binded with the events if they are inserted from other frame. In testing, if I try the same thingwithinthe SAME frame the the events get binded correctly. Am I missing something here? Is this a limitation of jQuery?
[jQuery] ready() function different when inside a frame?
I have a frame that I want to use the same instance of jquery as in the parent window. Here is what I did: $ = window.parent.$; $(function() { $(#test).click(function() { $(#hold).append('a href=#Inserted from iFrame/a br /'); }); }); For some reason, the click event is not being bound, and the html is not getting appended. BUT, if I remove the click function, and just load the page without it, it DOES correctly get inserted into the parent. What is going on here? And why can't I get a click function to work in a frame using the parents jquery instance? Example: http://web2.puc.edu/PUC/files/bind.html
[jQuery] Re: Bind events on DOM elements inserted from other frame
So, would this be in addition to my normal document ready? On Sep 17, 7:12 pm, ricardobeat [EMAIL PROTECTED] wrote: Not sure but $(frames['frame'].document).ready() should work (from the parent window). On Sep 17, 8:21 pm, hubbs [EMAIL PROTECTED] wrote: Ok, I am realizing it has to do with the do with the $(document).ready function. If I just use: $ = window.parent.$; $(#hold).append('a href=#Inserted from iFrame/a br /'); In the iframe, it correctly adds the link to the parent, and it gets the event from livequery! Hooray!! But, obviously I need to add back a document ready function so that I can bind events within the iframe. How does that need to be done in this context? As I said, using the normal document ready does not work. On Sep 17, 9:58 am, ricardobeat [EMAIL PROTECTED] wrote: using the iframe's jQuery object: $('.classinparentframe', parent.window.document) Ideally if the contents of the iframe are always known to you, you should use only one instance of jQuery on the parent window and do all your stuff from it, it's simpler to debug also. On Sep 16, 10:29 pm, hubbs [EMAIL PROTECTED] wrote: Thanks Ricardo. But what if I wanted to access the parent document from WITHIN the iframe? On Sep 16, 12:27 pm, ricardobeat [EMAIL PROTECTED] wrote: You need to understand that a frame is another 'window' instance, it doesn't have the same jQuery object as the parent window unless you tell it to. So the '$' object you use in firebug console is always the one from the parent window. If i'm not mistaken you can acess frame content with the parent window's jQuery object using $('.classinsidetheframe', frames['name'].document).css(); On Sep 16, 1:48 pm, hubbs [EMAIL PROTECTED] wrote: Ok Brandon, I found this in another post: var doc = $('#testframe')[0].contentWindow.document; $(doc.body).append('spantest/span'); This seems like it would help, but I am not sure how to use this, along with what you posted to get it working correctly. Somehow sending the GET within the context of the contentWindow is confusing me, and I just can't get it working. On Sep 15, 9:18 am, Brandon Aaron [EMAIL PROTECTED] wrote: To see what I mean run this in Firebug: $('iframe')[0].contentWindow.$ = $; Then click on the link in the iframe and it will behave as you expect. -- Brandon Aaron On Mon, Sep 15, 2008 at 9:13 AM, Brandon Aaron [EMAIL PROTECTED]wrote: This would work if you used the frames parent instance of jQuery. LiveQuery works by monitoring the DOM methods within jQuery. Since within the frame you are using a new instance of jQuery, LiveQuery will not be monitoring its DOM methods. -- Brandon Aaron On Sun, Sep 14, 2008 at 11:04 PM, hubbs [EMAIL PROTECTED] wrote: I can confirm that using event delegation will fix this problem. I guess that it is just a problem with the LiveQuery plugin. Brandon, if you are where around here, could you comment on this? Thanks. On Sep 14, 2:29 pm, hubbs [EMAIL PROTECTED] wrote: I have a working example of this, and would really like help understanding why bind or livequery does not bind events to DOM elements that are inserted from an iframe. http://web2.puc.edu/PUC/files/bind.html Clicking the insert from frame link will append links to the parent frame, which won't pick up the click event. But, clicking the insert from body link will append links within the same frame and will correctly have the click events bound. Why is this happening? On Sep 12, 9:02 pm, hubbs [EMAIL PROTECTED] wrote: I have been experiencing strangeness with trying tobindevents to DOM elements that have been inserted from a different frame using .get(). For some reason the elements don't be binded with the events if they are inserted from other frame. In testing, if I try the same thingwithinthe SAME frame the the events get binded correctly. Am I missing something here? Is this a limitation of jQuery?
[jQuery] Re: Bind events on DOM elements inserted from other frame
Well, I had this same thing working before. But it does not solve the problem of using the parent frames instance of jQuery, which I don't know how to do. Using your example inserts the DOM elements, but they don't get the events, because they don't don't use the parents jQuery, which is the entire problem. How can I use the parents instance of jQuery as you say? On Sep 17, 9:58 am, ricardobeat [EMAIL PROTECTED] wrote: using the iframe's jQuery object: $('.classinparentframe', parent.window.document) Ideally if the contents of the iframe are always known to you, you should use only one instance of jQuery on the parent window and do all your stuff from it, it's simpler to debug also. On Sep 16, 10:29 pm, hubbs [EMAIL PROTECTED] wrote: Thanks Ricardo. But what if I wanted to access the parent document from WITHIN the iframe? On Sep 16, 12:27 pm, ricardobeat [EMAIL PROTECTED] wrote: You need to understand that a frame is another 'window' instance, it doesn't have the same jQuery object as the parent window unless you tell it to. So the '$' object you use in firebug console is always the one from the parent window. If i'm not mistaken you can acess frame content with the parent window's jQuery object using $('.classinsidetheframe', frames['name'].document).css(); On Sep 16, 1:48 pm, hubbs [EMAIL PROTECTED] wrote: Ok Brandon, I found this in another post: var doc = $('#testframe')[0].contentWindow.document; $(doc.body).append('spantest/span'); This seems like it would help, but I am not sure how to use this, along with what you posted to get it working correctly. Somehow sending the GET within the context of the contentWindow is confusing me, and I just can't get it working. On Sep 15, 9:18 am, Brandon Aaron [EMAIL PROTECTED] wrote: To see what I mean run this in Firebug: $('iframe')[0].contentWindow.$ = $; Then click on the link in the iframe and it will behave as you expect. -- Brandon Aaron On Mon, Sep 15, 2008 at 9:13 AM, Brandon Aaron [EMAIL PROTECTED]wrote: This would work if you used the frames parent instance of jQuery. LiveQuery works by monitoring the DOM methods within jQuery. Since within the frame you are using a new instance of jQuery, LiveQuery will not be monitoring its DOM methods. -- Brandon Aaron On Sun, Sep 14, 2008 at 11:04 PM, hubbs [EMAIL PROTECTED] wrote: I can confirm that using event delegation will fix this problem. I guess that it is just a problem with the LiveQuery plugin. Brandon, if you are where around here, could you comment on this? Thanks. On Sep 14, 2:29 pm, hubbs [EMAIL PROTECTED] wrote: I have a working example of this, and would really like help understanding why bind or livequery does not bind events to DOM elements that are inserted from an iframe. http://web2.puc.edu/PUC/files/bind.html Clicking the insert from frame link will append links to the parent frame, which won't pick up the click event. But, clicking the insert from body link will append links within the same frame and will correctly have the click events bound. Why is this happening? On Sep 12, 9:02 pm, hubbs [EMAIL PROTECTED] wrote: I have been experiencing strangeness with trying tobindevents to DOM elements that have been inserted from a different frame using .get(). For some reason the elements don't be binded with the events if they are inserted from other frame. In testing, if I try the same thingwithinthe SAME frame the the events get binded correctly. Am I missing something here? Is this a limitation of jQuery?
[jQuery] Re: Bind events on DOM elements inserted from other frame
Ok, I have the following in my iframe: $(document).ready(function() { $ = window.parent.$; $(#test).click(function() { $(#hold).append('a href=#Inserted from iFrame/a br /'); }); }); This seems to be what I would need, but now it won't load content into the parent...arg. On Sep 17, 9:58 am, ricardobeat [EMAIL PROTECTED] wrote: using the iframe's jQuery object: $('.classinparentframe', parent.window.document) Ideally if the contents of the iframe are always known to you, you should use only one instance of jQuery on the parent window and do all your stuff from it, it's simpler to debug also. On Sep 16, 10:29 pm, hubbs [EMAIL PROTECTED] wrote: Thanks Ricardo. But what if I wanted to access the parent document from WITHIN the iframe? On Sep 16, 12:27 pm, ricardobeat [EMAIL PROTECTED] wrote: You need to understand that a frame is another 'window' instance, it doesn't have the same jQuery object as the parent window unless you tell it to. So the '$' object you use in firebug console is always the one from the parent window. If i'm not mistaken you can acess frame content with the parent window's jQuery object using $('.classinsidetheframe', frames['name'].document).css(); On Sep 16, 1:48 pm, hubbs [EMAIL PROTECTED] wrote: Ok Brandon, I found this in another post: var doc = $('#testframe')[0].contentWindow.document; $(doc.body).append('spantest/span'); This seems like it would help, but I am not sure how to use this, along with what you posted to get it working correctly. Somehow sending the GET within the context of the contentWindow is confusing me, and I just can't get it working. On Sep 15, 9:18 am, Brandon Aaron [EMAIL PROTECTED] wrote: To see what I mean run this in Firebug: $('iframe')[0].contentWindow.$ = $; Then click on the link in the iframe and it will behave as you expect. -- Brandon Aaron On Mon, Sep 15, 2008 at 9:13 AM, Brandon Aaron [EMAIL PROTECTED]wrote: This would work if you used the frames parent instance of jQuery. LiveQuery works by monitoring the DOM methods within jQuery. Since within the frame you are using a new instance of jQuery, LiveQuery will not be monitoring its DOM methods. -- Brandon Aaron On Sun, Sep 14, 2008 at 11:04 PM, hubbs [EMAIL PROTECTED] wrote: I can confirm that using event delegation will fix this problem. I guess that it is just a problem with the LiveQuery plugin. Brandon, if you are where around here, could you comment on this? Thanks. On Sep 14, 2:29 pm, hubbs [EMAIL PROTECTED] wrote: I have a working example of this, and would really like help understanding why bind or livequery does not bind events to DOM elements that are inserted from an iframe. http://web2.puc.edu/PUC/files/bind.html Clicking the insert from frame link will append links to the parent frame, which won't pick up the click event. But, clicking the insert from body link will append links within the same frame and will correctly have the click events bound. Why is this happening? On Sep 12, 9:02 pm, hubbs [EMAIL PROTECTED] wrote: I have been experiencing strangeness with trying tobindevents to DOM elements that have been inserted from a different frame using .get(). For some reason the elements don't be binded with the events if they are inserted from other frame. In testing, if I try the same thingwithinthe SAME frame the the events get binded correctly. Am I missing something here? Is this a limitation of jQuery?
[jQuery] Re: Bind events on DOM elements inserted from other frame
Ok, I am realizing it has to do with the do with the $(document).ready function. If I just use: $ = window.parent.$; $(#hold).append('a href=#Inserted from iFrame/a br /'); In the iframe, it correctly adds the link to the parent, and it gets the event from livequery! Hooray!! But, obviously I need to add back a document ready function so that I can bind events within the iframe. How does that need to be done in this context? As I said, using the normal document ready does not work. On Sep 17, 9:58 am, ricardobeat [EMAIL PROTECTED] wrote: using the iframe's jQuery object: $('.classinparentframe', parent.window.document) Ideally if the contents of the iframe are always known to you, you should use only one instance of jQuery on the parent window and do all your stuff from it, it's simpler to debug also. On Sep 16, 10:29 pm, hubbs [EMAIL PROTECTED] wrote: Thanks Ricardo. But what if I wanted to access the parent document from WITHIN the iframe? On Sep 16, 12:27 pm, ricardobeat [EMAIL PROTECTED] wrote: You need to understand that a frame is another 'window' instance, it doesn't have the same jQuery object as the parent window unless you tell it to. So the '$' object you use in firebug console is always the one from the parent window. If i'm not mistaken you can acess frame content with the parent window's jQuery object using $('.classinsidetheframe', frames['name'].document).css(); On Sep 16, 1:48 pm, hubbs [EMAIL PROTECTED] wrote: Ok Brandon, I found this in another post: var doc = $('#testframe')[0].contentWindow.document; $(doc.body).append('spantest/span'); This seems like it would help, but I am not sure how to use this, along with what you posted to get it working correctly. Somehow sending the GET within the context of the contentWindow is confusing me, and I just can't get it working. On Sep 15, 9:18 am, Brandon Aaron [EMAIL PROTECTED] wrote: To see what I mean run this in Firebug: $('iframe')[0].contentWindow.$ = $; Then click on the link in the iframe and it will behave as you expect. -- Brandon Aaron On Mon, Sep 15, 2008 at 9:13 AM, Brandon Aaron [EMAIL PROTECTED]wrote: This would work if you used the frames parent instance of jQuery. LiveQuery works by monitoring the DOM methods within jQuery. Since within the frame you are using a new instance of jQuery, LiveQuery will not be monitoring its DOM methods. -- Brandon Aaron On Sun, Sep 14, 2008 at 11:04 PM, hubbs [EMAIL PROTECTED] wrote: I can confirm that using event delegation will fix this problem. I guess that it is just a problem with the LiveQuery plugin. Brandon, if you are where around here, could you comment on this? Thanks. On Sep 14, 2:29 pm, hubbs [EMAIL PROTECTED] wrote: I have a working example of this, and would really like help understanding why bind or livequery does not bind events to DOM elements that are inserted from an iframe. http://web2.puc.edu/PUC/files/bind.html Clicking the insert from frame link will append links to the parent frame, which won't pick up the click event. But, clicking the insert from body link will append links within the same frame and will correctly have the click events bound. Why is this happening? On Sep 12, 9:02 pm, hubbs [EMAIL PROTECTED] wrote: I have been experiencing strangeness with trying tobindevents to DOM elements that have been inserted from a different frame using .get(). For some reason the elements don't be binded with the events if they are inserted from other frame. In testing, if I try the same thingwithinthe SAME frame the the events get binded correctly. Am I missing something here? Is this a limitation of jQuery?
[jQuery] Re: Bind events on DOM elements inserted from other frame
Ok Brandon, I found this in another post: var doc = $('#testframe')[0].contentWindow.document; $(doc.body).append('spantest/span'); This seems like it would help, but I am not sure how to use this, along with what you posted to get it working correctly. Somehow sending the GET within the context of the contentWindow is confusing me, and I just can't get it working. On Sep 15, 9:18 am, Brandon Aaron [EMAIL PROTECTED] wrote: To see what I mean run this in Firebug: $('iframe')[0].contentWindow.$ = $; Then click on the link in the iframe and it will behave as you expect. -- Brandon Aaron On Mon, Sep 15, 2008 at 9:13 AM, Brandon Aaron [EMAIL PROTECTED]wrote: This would work if you used the frames parent instance of jQuery. LiveQuery works by monitoring the DOM methods within jQuery. Since within the frame you are using a new instance of jQuery, LiveQuery will not be monitoring its DOM methods. -- Brandon Aaron On Sun, Sep 14, 2008 at 11:04 PM, hubbs [EMAIL PROTECTED] wrote: I can confirm that using event delegation will fix this problem. I guess that it is just a problem with the LiveQuery plugin. Brandon, if you are where around here, could you comment on this? Thanks. On Sep 14, 2:29 pm, hubbs [EMAIL PROTECTED] wrote: I have a working example of this, and would really like help understanding why bind or livequery does not bind events to DOM elements that are inserted from an iframe. http://web2.puc.edu/PUC/files/bind.html Clicking the insert from frame link will append links to the parent frame, which won't pick up the click event. But, clicking the insert from body link will append links within the same frame and will correctly have the click events bound. Why is this happening? On Sep 12, 9:02 pm, hubbs [EMAIL PROTECTED] wrote: I have been experiencing strangeness with trying tobindevents to DOM elements that have been inserted from a different frame using .get(). For some reason the elements don't be binded with the events if they are inserted from other frame. In testing, if I try the same thingwithinthe SAME frame the the events get binded correctly. Am I missing something here? Is this a limitation of jQuery?
[jQuery] Re: Bind events on DOM elements inserted from other frame
Thanks Ricardo. But what if I wanted to access the parent document from WITHIN the iframe? On Sep 16, 12:27 pm, ricardobeat [EMAIL PROTECTED] wrote: You need to understand that a frame is another 'window' instance, it doesn't have the same jQuery object as the parent window unless you tell it to. So the '$' object you use in firebug console is always the one from the parent window. If i'm not mistaken you can acess frame content with the parent window's jQuery object using $('.classinsidetheframe', frames['name'].document).css(); On Sep 16, 1:48 pm, hubbs [EMAIL PROTECTED] wrote: Ok Brandon, I found this in another post: var doc = $('#testframe')[0].contentWindow.document; $(doc.body).append('spantest/span'); This seems like it would help, but I am not sure how to use this, along with what you posted to get it working correctly. Somehow sending the GET within the context of the contentWindow is confusing me, and I just can't get it working. On Sep 15, 9:18 am, Brandon Aaron [EMAIL PROTECTED] wrote: To see what I mean run this in Firebug: $('iframe')[0].contentWindow.$ = $; Then click on the link in the iframe and it will behave as you expect. -- Brandon Aaron On Mon, Sep 15, 2008 at 9:13 AM, Brandon Aaron [EMAIL PROTECTED]wrote: This would work if you used the frames parent instance of jQuery. LiveQuery works by monitoring the DOM methods within jQuery. Since within the frame you are using a new instance of jQuery, LiveQuery will not be monitoring its DOM methods. -- Brandon Aaron On Sun, Sep 14, 2008 at 11:04 PM, hubbs [EMAIL PROTECTED] wrote: I can confirm that using event delegation will fix this problem. I guess that it is just a problem with the LiveQuery plugin. Brandon, if you are where around here, could you comment on this? Thanks. On Sep 14, 2:29 pm, hubbs [EMAIL PROTECTED] wrote: I have a working example of this, and would really like help understanding why bind or livequery does not bind events to DOM elements that are inserted from an iframe. http://web2.puc.edu/PUC/files/bind.html Clicking the insert from frame link will append links to the parent frame, which won't pick up the click event. But, clicking the insert from body link will append links within the same frame and will correctly have the click events bound. Why is this happening? On Sep 12, 9:02 pm, hubbs [EMAIL PROTECTED] wrote: I have been experiencing strangeness with trying tobindevents to DOM elements that have been inserted from a different frame using .get(). For some reason the elements don't be binded with the events if they are inserted from other frame. In testing, if I try the same thingwithinthe SAME frame the the events get binded correctly. Am I missing something here? Is this a limitation of jQuery?
[jQuery] Bind events on DOM elements inserted from other frame
I have been experiencing strangeness with trying to bind events to DOM elements that have been inserted from a different frame using .get(). For some reason the elements don't be binded with the events if they are inserted from other frame. In testing, if I try the same thing within the SAME frame the the events get binded correctly. Am I missing something here? Is this a limitation of jQuery?
[jQuery] Re: Nesting if statements not working
Thanks guys, this fixed it! On Sep 1, 6:37 pm, Jason Huck [EMAIL PROTECTED] wrote: One thing I would suggest is casting the .val() as an integer before comparing it: var dulicateCheck = parseInt($(#duplicateInput).val()); Otherwise it's doing a string comparison, which will throw off your results. - jason On Sep 1, 9:25 pm, hubbs [EMAIL PROTECTED] wrote: For some reason, when I am nesting if statements, it seems to bypass the first if, and go right to the second one, even if the value of #duplicateInput is more than 10. I want the statement to check to see if the input field has a number that is equal or less than 10, then, if it is, throw an alert making sure they want to delete multiple items. If the number is higher than 10, an alert will let them know they need to enter a lower number. Did I do something wrong here? //Add click function and confirm to mass delete confirm button $(#massRemoveAssetConfirm).click(function() { var dulicateCheck = $(#duplicateInput).val(); if (dulicateCheck = 10) { //Confirm that we want to mass delete assets var answerDelete = confirm(Are you sure you want to delete multiple assets? This cannot be undone!); if (answerDelete) { //Find all checkboxes that are checked, and put their values into an array $ (#adminToolsHoldListing :checkbox:checked).each(function() { // Pass the values to ajax post $.ajax({ type: POST, url: this.value + ?action=delete }); }); //Hide the asset we just delete from the asset list $(#adminToolsHoldListing .scroll input:checked).parent(.deleteCheck).parent(.itemHolder).hide(); //Remove the contents of the iframe, for the current asset that we deleted $(#assetEditFrame).contents().html(); } } else { alert(You are limited to 10 duplicates or less, please adjust your value.); $(#duplicateInput).val(); return false; } });
[jQuery] Nesting if statements not working
For some reason, when I am nesting if statements, it seems to bypass the first if, and go right to the second one, even if the value of #duplicateInput is more than 10. I want the statement to check to see if the input field has a number that is equal or less than 10, then, if it is, throw an alert making sure they want to delete multiple items. If the number is higher than 10, an alert will let them know they need to enter a lower number. Did I do something wrong here? //Add click function and confirm to mass delete confirm button $(#massRemoveAssetConfirm).click(function() { var dulicateCheck = $(#duplicateInput).val(); if (dulicateCheck = 10) { //Confirm that we want to mass delete assets var answerDelete = confirm(Are you sure you want to delete multiple assets? This cannot be undone!); if (answerDelete) { //Find all checkboxes that are checked, and put their values into an array $ (#adminToolsHoldListing :checkbox:checked).each(function() { // Pass the values to ajax post $.ajax({ type: POST, url: this.value + ?action=delete }); }); //Hide the asset we just delete from the asset list $(#adminToolsHoldListing .scroll input:checked).parent(.deleteCheck).parent(.itemHolder).hide(); //Remove the contents of the iframe, for the current asset that we deleted $(#assetEditFrame).contents().html(); } } else { alert(You are limited to 10 duplicates or less, please adjust your value.); $(#duplicateInput).val(); return false; } });
[jQuery] Using each() to check for content
I have a listing of links that are titles for items in my database. Each item might have a description in the database as well, so I was wanting to print the description, then replace it with a * if there is any text for the description. The descriptions contain HTML such as links, so inserting this into my anchor tag makes it invalid HTML, which I understand. But I remove it from the DOM and replace it with a *. Strange thing is, it does not seem like it is getting removed correctly and replaced. Any ideas why this might be happening? (And yes, like I said, I understand it is incorrect HTML, but since it gets replaced almost instantly, I didn't think this would be a problem.) I am using: $(document).ready(function() { $(.test).each(function() { if ($(this).html() == ) { //Do nothing } else { $(this).html(*); } }); }); My links that need the content replaced: div class=itemHolderaItem Namespan class=testpContents a href=#Link/a/p/span/a/div div class=itemHolderaItem Namespan class=testpContents a href=#Link/a/p/span/a/div div class=itemHolderaItem Namespan class=testpContents a href=#Link/a/p/span/a/div
[jQuery] Re: Using each() to check for content
Thanks Michael, I expected that is was the invalid HTML, but didn't realize that the bowser would not let me get away with it, even if it was only for a split second before JS took over. I will change the way my list works to move the content outside of the anchor tag, and into a div. Thanks for clearing this up. On Aug 31, 2:18 pm, Michael Geary [EMAIL PROTECTED] wrote: Yes, it's the invalid HTML that is tripping you up. You can't nest one a tag inside another. The browser hoists the nested a tag outside the parent to avoid this. No, you can't insert HTML that's as invalid as this into the DOM, not even momentarily. You can insert *some* kinds of invalid HTML into the DOM. In your example, you also have a p tag nested inside an a tag, which is invalid too. The browser lets you get away with the, but not the nested a tags. Turn off all the JavaScript in your page (or make a simple test page with the same HTML), and look at the DOM in Firebug or any other DOM inspection tool. You'll see why you're getting surprising results. For example, here's what Firebug shows for one of your div elements: div class=itemHolder a Item Name span class=test pContents /p /span /a a href=#Link/a /div See how different that is from your original HTML? -Mike From: hubbs I have a listing of links that are titles for items in my database. Each item might have a description in the database as well, so I was wanting to print the description, then replace it with a * if there is any text for the description. The descriptions contain HTML such as links, so inserting this into my anchor tag makes it invalid HTML, which I understand. But I remove it from the DOM and replace it with a *. Strange thing is, it does not seem like it is getting removed correctly and replaced. Any ideas why this might be happening? (And yes, like I said, I understand it is incorrect HTML, but since it gets replaced almost instantly, I didn't think this would be a problem.) I am using: $(document).ready(function() { $(.test).each(function() { if ($(this).html() == ) { //Do nothing } else { $(this).html(*); } }); }); My links that need the content replaced: div class=itemHolderaItem Namespan class=testpContents a href=#Link/a/p/span/a/div div class=itemHolderaItem Namespan class=testpContents a href=#Link/a/p/span/a/div div class=itemHolderaItem Namespan class=testpContents a href=#Link/a/p/span/a/div
[jQuery] keypress event using $(this)
I have a simple keypress event that throws an alert when you press a or s. Is it possible to bind this event to specific elements, so that it is not a global keypress, but only fired if the test link is first clicked. Then, $(this) would be used to get attributes of the clicked element if needed. Any ideas on how to get that to work, or if it is possible? $(#test).keypress(function(e) { switch(e.which) { case 97:alert(A pushed!); break; // user presses the s key case 115: alert(S pushed!) } });
[jQuery] Re: Livequery and iFrames
Ok, lets take a step back. Lets say I want to just try and bind the events, rather than using Livequery to see if this fixes the problem. Since I want to bind the draggable UI, how would I do this? What kind of event does the draggable get, click? $(#adminEditListingB .itemHolder a).draggable({ helper: 'clone', appendTo: 'body', cursor: 'move' }); How could I rebind this, and hopefully fix the cross frame problem? On Aug 24, 6:25 pm, hubbs [EMAIL PROTECTED] wrote: I worked on another, simpler example of reloading the listing with a link, and I get the same unwanted results. In the iframe: $(#refreshB).click(function() { $.ajax({ type: GET, url: http://www.mysite.com;, beforeSend: function() { $(#adminToolsListingB .scroll, parent.document).html(); $(#adminToolsListingB .ajaxLoading, parent.document).show(); }, success: function(html) { $(#adminToolsListingB .ajaxLoading, parent.document).hide(); $(#adminEditListingB .scroll, parent.document).html(html); } }); return false; }); The link: a href=# id=refreshBRefresh/a Still not rebinding the events in the parent frame. I am missing something here? It seems that this should work, as it is updating the DOM in the parent frame correctly, and I would expect Livequery to see that, and rebind. On Aug 24, 4:02 pm, hubbs [EMAIL PROTECTED] wrote: I am trying to track down a problem, and I am wondering if it has to do with iFrames. I use livequery to rebind some the jQuery UI draggable event to a list of links. I have an ajax refresh button, which refreshes the list, and livequery rebinds the draggable events, which works great. But, I have an iFrame on the page which will create a new link within that list. So, after the form is submitted in the iframe, it uses the .ajax() GET method to reload the list of links in the parent window, exactly how the ajax refresh button works. But, it seems that livequery is not rebinding the UI draggable events, and I am wondering if it is because the change came from the iFrame. Does this seem like it could be the problem, or should I keep digging? This one works: $.ajax({ type: GET, url: http://www.mysite.com;, beforeSend: function() { $(#adminToolsListingA .scroll).html(); $ (#adminToolsListingA .ajaxLoading).show(); }, success: function(html) { $ (#adminToolsListingA .ajaxLoading).hide(); $ (#adminEditListingA .scroll).html(html); } }); This one does not: $.ajax({ type: GET, url: http://www.mysite.com;, beforeSend: function() { $(#adminToolsListingB .scroll, parent.document).html(); $(#adminToolsListingB .ajaxLoading, parent.document).show(); }, success: function(html) { $(#adminToolsListingB .ajaxLoading, parent.document).hide(); $(#adminEditListingB .scroll, parent.document).html(html); } }); Livequery binding draggable UI: $(#adminEditListingB .itemHolder a).livequery(function() { $(this).draggable({ helper: 'clone', appendTo: 'body', cursor: 'move' }); });
[jQuery] Understanding event delegation
I am working to replace all of my uses of livequery with event delegation (is this even a good idea?) and have a few questions. I have a simple script that will add a selected class to a link when it is clicked. It does work using event delegation, but it seems that it is not limiting it to anchor tags, but will also add the selected class to any spans that are inside my anchor. This seems strange, and is not what I want, is something wrong with the following code? $('body').click(function(event) { var $target = $(event.target); if ($target.is('.scroll a')) { $(a.selected).removeClass(selected); $(event.target).addClass(selected); } });
[jQuery] Re: Understanding event delegation
Thank you, that fixed it. Is the limitation of is() a javascript limitation, or a jQuery limitation? Would this be coming in a new version of jQuery? Also, with event delegation, would you recommending using it for all event instances on a page? I have a few places where a single click event is added to an ID, and I figure it is really not necessary to mess with event delegation there. On Aug 26, 11:31 am, Ariel Flesler [EMAIL PROTECTED] wrote: Note that is() doesn't accept complex selectors (yet). The reason of your problems is probably this. Event delegation is surely the best approach, if you can live with its difficulties. -- Ariel Fleslerhttp://flesler.blogspot.com On Aug 26, 2:31 pm, hubbs [EMAIL PROTECTED] wrote: I am working to replace all of my uses of livequery with event delegation (is this even a good idea?) and have a few questions. I have a simple script that will add a selected class to a link when it is clicked. It does work using event delegation, but it seems that it is not limiting it to anchor tags, but will also add the selected class to any spans that are inside my anchor. This seems strange, and is not what I want, is something wrong with the following code? $('body').click(function(event) { var $target = $(event.target); if ($target.is('.scroll a')) { $(a.selected).removeClass(selected); $(event.target).addClass(selected); } });
[jQuery] Re: Understanding event delegation
Hmmm, I take that back. It still seems like the is() is able to select child elements of the anchor, so when you have an anchor set as block, with a few spans to style text, it is hard to click on the actual anchor to give it the class. Is this normal? On Aug 26, 11:37 am, hubbs [EMAIL PROTECTED] wrote: Thank you, that fixed it. Is the limitation of is() a javascript limitation, or a jQuery limitation? Would this be coming in a new version of jQuery? Also, with event delegation, would you recommending using it for all event instances on a page? I have a few places where a single click event is added to an ID, and I figure it is really not necessary to mess with event delegation there. On Aug 26, 11:31 am, Ariel Flesler [EMAIL PROTECTED] wrote: Note that is() doesn't accept complex selectors (yet). The reason of your problems is probably this. Event delegation is surely the best approach, if you can live with its difficulties. -- Ariel Fleslerhttp://flesler.blogspot.com On Aug 26, 2:31 pm, hubbs [EMAIL PROTECTED] wrote: I am working to replace all of my uses of livequery with event delegation (is this even a good idea?) and have a few questions. I have a simple script that will add a selected class to a link when it is clicked. It does work using event delegation, but it seems that it is not limiting it to anchor tags, but will also add the selected class to any spans that are inside my anchor. This seems strange, and is not what I want, is something wrong with the following code? $('body').click(function(event) { var $target = $(event.target); if ($target.is('.scroll a')) { $(a.selected).removeClass(selected); $(event.target).addClass(selected); } });
[jQuery] Re: Understanding event delegation
Bummer that is has to be done this way. If I have a large block of code that is needed for the click event, I would have to put it twice in my code to account for the spans inside of my anchor. Even with doing this, and having more js, is it still a better idea to use event delegation rather than something like livequery, where each element gets an event binded? On Aug 26, 2:01 pm, Brian Schilt [EMAIL PROTECTED] wrote: so when you have an anchor set as block, with a few spans to style text, it is hard to click on the actual anchor to give it the class. Is this normal? That is a normal reaction when using event delegation and its one of the difficulties that Ariel was probably referring to. You'll need to set up your event delegation to account for 1) clicking on the actual anchor and 2) clicking on the child span tag. You'll need to add a condition to your IF statement to account for the span tags...When $target is a span, select its parent anchor element. if ($target.is('.scroll a')) { $(a.selected).removeClass(selected); $(event.target).addClass(selected);} else if ($target.is('span')) { var $anchor = $target.parent('a'); $(a.selected).removeClass(selected); $anchor.addClass(selected); } Brian On Aug 26, 4:22 pm, hubbs [EMAIL PROTECTED] wrote: Hmmm, I take that back. It still seems like the is() is able to select child elements of the anchor, so when you have an anchor set as block, with a few spans to style text, it is hard to click on the actual anchor to give it the class. Is this normal? On Aug 26, 11:37 am, hubbs [EMAIL PROTECTED] wrote: Thank you, that fixed it. Is the limitation of is() a javascript limitation, or a jQuery limitation? Would this be coming in a new version of jQuery? Also, with event delegation, would you recommending using it for all event instances on a page? I have a few places where a single click event is added to an ID, and I figure it is really not necessary to mess with event delegation there. On Aug 26, 11:31 am, Ariel Flesler [EMAIL PROTECTED] wrote: Note that is() doesn't accept complex selectors (yet). The reason of your problems is probably this. Event delegation is surely the best approach, if you can live with its difficulties. -- Ariel Fleslerhttp://flesler.blogspot.com On Aug 26, 2:31 pm, hubbs [EMAIL PROTECTED] wrote: I am working to replace all of my uses of livequery with event delegation (is this even a good idea?) and have a few questions. I have a simple script that will add a selected class to a link when it is clicked. It does work using event delegation, but it seems that it is not limiting it to anchor tags, but will also add the selected class to any spans that are inside my anchor. This seems strange, and is not what I want, is something wrong with the following code? $('body').click(function(event) { var $target = $(event.target); if ($target.is('.scroll a')) { $(a.selected).removeClass(selected); $(event.target).addClass(selected); } });
[jQuery] Using keypress for key combination
I have been looking for a way to have a key combination fire an alert, but searching the group I have not really found what I was looking for. There are some plugins that I have found, but I would rather just use jQuery without anything additional. So, I found this: $(input:text).bind(keypress,function(e) { var key = e.keyCode || e.charCode; if(key == 13) { alert(You clicked a key!); } } ) How could I have a key combination fire such, such as cntrl + d or something similar?
[jQuery] Livequery and iFrames
I am trying to track down a problem, and I am wondering if it has to do with iFrames. I use livequery to rebind some the jQuery UI draggable event to a list of links. I have an ajax refresh button, which refreshes the list, and livequery rebinds the draggable events, which works great. But, I have an iFrame on the page which will create a new link within that list. So, after the form is submitted in the iframe, it uses the .ajax() GET method to reload the list of links in the parent window, exactly how the ajax refresh button works. But, it seems that livequery is not rebinding the UI draggable events, and I am wondering if it is because the change came from the iFrame. Does this seem like it could be the problem, or should I keep digging? This one works: $.ajax({ type: GET, url: http://www.mysite.com;, beforeSend: function() { $(#adminToolsListingA .scroll).html(); $ (#adminToolsListingA .ajaxLoading).show(); }, success: function(html) { $ (#adminToolsListingA .ajaxLoading).hide(); $ (#adminEditListingA .scroll).html(html); } }); This one does not: $.ajax({ type: GET, url: http://www.mysite.com;, beforeSend: function() { $(#adminToolsListingB .scroll, parent.document).html(); $(#adminToolsListingB .ajaxLoading, parent.document).show(); }, success: function(html) { $(#adminToolsListingB .ajaxLoading, parent.document).hide(); $(#adminEditListingB .scroll, parent.document).html(html); } }); Livequery binding draggable UI: $(#adminEditListingB .itemHolder a).livequery(function() { $(this).draggable({ helper: 'clone', appendTo: 'body', cursor: 'move' }); });
[jQuery] Re: Livequery and iFrames
I worked on another, simpler example of reloading the listing with a link, and I get the same unwanted results. In the iframe: $(#refreshB).click(function() { $.ajax({ type: GET, url: http://www.mysite.com;, beforeSend: function() { $(#adminToolsListingB .scroll, parent.document).html(); $(#adminToolsListingB .ajaxLoading, parent.document).show(); }, success: function(html) { $(#adminToolsListingB .ajaxLoading, parent.document).hide(); $(#adminEditListingB .scroll, parent.document).html(html); } }); return false; }); The link: a href=# id=refreshBRefresh/a Still not rebinding the events in the parent frame. I am missing something here? It seems that this should work, as it is updating the DOM in the parent frame correctly, and I would expect Livequery to see that, and rebind. On Aug 24, 4:02 pm, hubbs [EMAIL PROTECTED] wrote: I am trying to track down a problem, and I am wondering if it has to do with iFrames. I use livequery to rebind some the jQuery UI draggable event to a list of links. I have an ajax refresh button, which refreshes the list, and livequery rebinds the draggable events, which works great. But, I have an iFrame on the page which will create a new link within that list. So, after the form is submitted in the iframe, it uses the .ajax() GET method to reload the list of links in the parent window, exactly how the ajax refresh button works. But, it seems that livequery is not rebinding the UI draggable events, and I am wondering if it is because the change came from the iFrame. Does this seem like it could be the problem, or should I keep digging? This one works: $.ajax({ type: GET, url: http://www.mysite.com;, beforeSend: function() { $(#adminToolsListingA .scroll).html(); $ (#adminToolsListingA .ajaxLoading).show(); }, success: function(html) { $ (#adminToolsListingA .ajaxLoading).hide(); $ (#adminEditListingA .scroll).html(html); } }); This one does not: $.ajax({ type: GET, url: http://www.mysite.com;, beforeSend: function() { $(#adminToolsListingB .scroll, parent.document).html(); $(#adminToolsListingB .ajaxLoading, parent.document).show(); }, success: function(html) { $(#adminToolsListingB .ajaxLoading, parent.document).hide(); $(#adminEditListingB .scroll, parent.document).html(html); } }); Livequery binding draggable UI: $(#adminEditListingB .itemHolder a).livequery(function() { $(this).draggable({ helper: 'clone', appendTo: 'body', cursor: 'move' }); });
[jQuery] Check checkbox based on ID list
I am looking for ideas on how to check some checkboxes based on a list of id's that match the id's of the checkboxes. Example: div id=checkedValues 10, 14, 11 /div div id=checkBoxes input type=checkbox value=1 id=10 name=10 / input type=checkbox value=1 id=11 name=11 / input type=checkbox value=1 id=12 name=12 / input type=checkbox value=1 id=13 name=13 / input type=checkbox value=1 id=14 name=14 / /div In this example, when the page loads, I need the checkboxes with id's 10, 14, and 11 to be checked, and the rest to remain unchecked. The values in checkedValues come from the server, so I need to mirror these with a checked value if that id comes up within the checkedValues div. I know there must be an easy, or better way to do this, just looking for ideas. Thanks!
[jQuery] Re: Check checkbox based on ID list
There is also the option of me putting the checked values into an array if that would help with this... On Aug 22, 11:27 am, hubbs [EMAIL PROTECTED] wrote: I am looking for ideas on how to check some checkboxes based on a list of id's that match the id's of the checkboxes. Example: div id=checkedValues 10, 14, 11 /div div id=checkBoxes input type=checkbox value=1 id=10 name=10 / input type=checkbox value=1 id=11 name=11 / input type=checkbox value=1 id=12 name=12 / input type=checkbox value=1 id=13 name=13 / input type=checkbox value=1 id=14 name=14 / /div In this example, when the page loads, I need the checkboxes with id's 10, 14, and 11 to be checked, and the rest to remain unchecked. The values in checkedValues come from the server, so I need to mirror these with a checked value if that id comes up within the checkedValues div. I know there must be an easy, or better way to do this, just looking for ideas. Thanks!
[jQuery] Re: Check checkbox based on ID list
I figured it out, I just had my server write the jQuery attributes: $(#12).attr(checked, checked); On Aug 22, 11:58 am, hubbs [EMAIL PROTECTED] wrote: There is also the option of me putting the checked values into an array if that would help with this... On Aug 22, 11:27 am, hubbs [EMAIL PROTECTED] wrote: I am looking for ideas on how to check some checkboxes based on a list of id's that match the id's of the checkboxes. Example: div id=checkedValues 10, 14, 11 /div div id=checkBoxes input type=checkbox value=1 id=10 name=10 / input type=checkbox value=1 id=11 name=11 / input type=checkbox value=1 id=12 name=12 / input type=checkbox value=1 id=13 name=13 / input type=checkbox value=1 id=14 name=14 / /div In this example, when the page loads, I need the checkboxes with id's 10, 14, and 11 to be checked, and the rest to remain unchecked. The values in checkedValues come from the server, so I need to mirror these with a checked value if that id comes up within the checkedValues div. I know there must be an easy, or better way to do this, just looking for ideas. Thanks!
[jQuery] Understanding JSON
I am trying to understand JSON, and could use a little help. So, if I have something like: { firstName: John, lastName: Smith, address: { streetAddress: 21 2nd Street, city: New York, state: NY, postalCode: 10021 }, phoneNumbers: [ 212 555-1234, 646 555-4567 ] } How would I use jQuery to write the values onto a page? And how do you go the other way, taking values and serializing them into JSON to be sent to the server? Thanks!
[jQuery] Re: Understanding JSON
Ah, I see. So the advantage here is that the server is just returning data to us, rather than a whole page, and having to use .find() to filter the page? Is it all based on speed, and bandwidth, or is there another huge advantage that I am missing? On Aug 20, 12:35 am, Giovanni Battista Lenoci [EMAIL PROTECTED] wrote: hubbs ha scritto: I am trying to understand JSON, and could use a little help. How would I use jQuery to write the values onto a page? user = { firstName: John, lastName: Smith, address: { streetAddress: 21 2nd Street, city: New York, state: NY, postalCode: 10021 }, phoneNumbers: [ 212 555-1234, 646 555-4567 ] } alert(user.firstName); alert(user.address.city); And how do you go the other way, taking values and serializing them into JSON to be sent to the server? Umh... I'm not sure I've understood the question. You don't have to send json data to the server, but the server sends json data to the client. For example, if you do an ajax request to a page.php that do a query to the db, and return the data, you'll user the function json_encode (php5, or PEAR on php4) to write the response for javascript. ?php $record['firstName'] = John; $record['address']['city'] = New York; echo json_encode($record); ? Bye :-) -- gianiaz.net - web solutions p.le bertacchi 66, 23100 sondrio (so) - italy +39 347 7196482
[jQuery] $.ajax() timeout
I seem to not be understanding how the ajax timeout works, because it does not seem to work how I thought. I was hope it would delay the ajax request, for the number of miliseconds that is specified, but that does not seem to be working. Is the timeout used for something different? Or is there a different way to delay an ajax request for a few seconds? Using: $.ajax({ type: GET, timeout: 5000, url: myurl.com, beforeSend: function() { $(#adminToolsListingA .scroll).html(); $(#adminToolsListingA .ajaxLoading).show(); }, success: function(html) { $(#adminToolsListingA .ajaxLoading).hide(); $(#adminEditListingA .scroll).html(html); } });
[jQuery] Re: $.ajax() timeout
Perfect! That works great, thank you! On Aug 20, 12:34 pm, Josh Nathanson [EMAIL PROTECTED] wrote: timeout is actually how long the request will wait to complete before it sends back a timeout error. You actually want setTimeout, like so. This will wait five seconds before doing the ajax request. var t = setTimeout( function() { $.ajax({ type: GET, url: myurl.com, beforeSend: function() { $(#adminToolsListingA .scroll).html(); $(#adminToolsListingA .ajaxLoading).show(); }, success: function(html) { $(#adminToolsListingA .ajaxLoading).hide(); $(#adminEditListingA .scroll).html(html); } }); }, 5000 ); -- Josh - Original Message - From: hubbs [EMAIL PROTECTED] To: jQuery (English) jquery-en@googlegroups.com Sent: Wednesday, August 20, 2008 11:25 AM Subject: [jQuery] $.ajax() timeout I seem to not be understanding how the ajax timeout works, because it does not seem to work how I thought. I was hope it would delay the ajax request, for the number of miliseconds that is specified, but that does not seem to be working. Is the timeout used for something different? Or is there a different way to delay an ajax request for a few seconds? Using: $.ajax({ type: GET, timeout: 5000, url: myurl.com, beforeSend: function() { $(#adminToolsListingA .scroll).html(); $(#adminToolsListingA .ajaxLoading).show(); }, success: function(html) { $(#adminToolsListingA .ajaxLoading).hide(); $(#adminEditListingA .scroll).html(html); } });
[jQuery] Re: Understanding JSON
Yes it does. Thanks for the explanation. On Aug 20, 12:34 pm, ak732 [EMAIL PROTECTED] wrote: What you're describing is more of a general AJAX thing. JSON is just an optional part of the whole AJAX mechanism. It's the data *format*, not the page update architecture. You could use XML or grow your own data format and still be updating only portions of the page, on demand, as opposed to doing full page refreshes. That make sense? Ah, I see. So the advantage here is that the server is just returning data to us, rather than a whole page, and having to use .find() to filter the page? Is it all based on speed, and bandwidth, or is there another huge advantage that I am missing?
[jQuery] Re: Show loading gif onclick, hide when iframe is loaded
Anyone know if there is a way to know when an iframe is finished loading? On Aug 19, 10:26 am, hubbs [EMAIL PROTECTED] wrote: I know how to show a loading gif when a link is clicked, but is it possible to know when the page is finished loading inside of an iframe, so that I can then hide the loading gif?
[jQuery] Show loading gif onclick, hide when iframe is loaded
I know how to show a loading gif when a link is clicked, but is it possible to know when the page is finished loading inside of an iframe, so that I can then hide the loading gif?
[jQuery] Re: Var and a child
Honestly guys, the var string1 = #This is string1; was just an example for posting here. :) I am not really using it. On Aug 18, 2:48 pm, ripple [EMAIL PROTECTED] wrote: I am just saying that I would never pass a variable with a string that started with anything other than an alpha-numeric value and have never see that done either. I would never write var string1 = #This is string1; var string2 = $This is string2; or div class=.class id=#id/div A lot of languages use some type of non-alpha-numeric character, as part of it's structure so I would never try to mix them. Other people have to read and work with that code also and it could get confusing and/or misleading. http://2whoa.com/dominate --- On Sun, 8/17/08, Michael Geary [EMAIL PROTECTED] wrote: From: Michael Geary [EMAIL PROTECTED] Subject: [jQuery] Re: Var and a child To: jquery-en@googlegroups.com Date: Sunday, August 17, 2008, 11:31 PM I'm afraid I don't follow you. We were talking about this line of code: var myVar = #testDiv; That looks like your basic string assignment statement to me. What is ugly about it, and how does it goes against your best practices? Thanks, -Mike From: ripple Ok, It's in my best practices, not to do something like that. It's just ugly coding. But if your ok with it, then you run with it. From: Michael Geary The # you're referring to: var myVar = #testDiv; is part of a string literal, not part of a variable name, so it's perfectly legal. From: ripple You can not declare a javascript var with a # as first char. try: var myVar = testDiv; $('#'+myVar+' .statusColor).css(background-color,#DBF18A); Other than that it should work. --- On Sun, 8/17/08, hubbs [EMAIL PROTECTED] wrote: From: hubbs I am trying to var to work as a selector along with an additional class, but I must have something wrong. var myVar = #testDiv; $(myVar .statusColor).css(background-color,#DBF18A); div id=testDiv span class=statusColorTest/span /div I need to select the child of the myVar, but the selector seems to be incorrect.
[jQuery] Re: Create array from checkbox id's
Still trying to get this to work, but it does not seem to. Will this work getting the id attribute? This was my goal. On Jul 23, 10:53 pm, Ca Phun Ung [EMAIL PROTECTED] wrote: hubbs wrote: Ariel, I tried this but the alert just says object Object, I was expecting it to alert me of each checkbox that was clicked, and show me the ID. Did I do something wrong? No. You're right. Ariel's solution is correct aswell. To get an alert box with the actual id's listed try this: alert(array.get()); Also to make Ariel's solution a little more elegant try this: $(#testLink).click(function() { var array = $(#text input:[EMAIL PROTECTED]'']:checked).map(function() { return this.id; }); alert(array.get()); return false; }); All I did was move the ID check into the element selector clause. Ca Phun Ung Web:http://yelotofu.com
[jQuery] Firefox 3 and packed jQuery
Anyone else having problems with Firefox 3 and the packed version of jQuery? It seems that it is not loading when I have an iframe in which the jQuery script is called. It seems to not load it for some reason, and fire bug is confused about the $ symbol. Anyone experienced this?
[jQuery] Re: Firefox 3 and packed jQuery
What exactly is the difference between minified and packed? On Jul 21, 1:41 am, Gordon [EMAIL PROTECTED] wrote: Have you tried the minified or raw versions in place of the packed one? Does your code work as expected if you do? I think the common consensus these days that best practice is to use the minified version instead of the packed one and enable gzip compression on the server. On Jul 21, 5:51 am, hubbs [EMAIL PROTECTED] wrote: Anyone else having problems with Firefox 3 and the packed version of jQuery? It seems that it is not loading when I have an iframe in which the jQuery script is called. It seems to not load it for some reason, and fire bug is confused about the $ symbol. Anyone experienced this?
[jQuery] .slice() a specific number of characters?
I am wondering if it is possible to use the .slice() method to keep 6 characters on the end of a URL in a href attribute, then append a new URL to the beginning? Or is there a better method to do this?
[jQuery] Re: .slice() a specific number of characters?
Perfect! Thank you very much! On Jul 20, 7:26 pm, Karl Swedberg [EMAIL PROTECTED] wrote: sure, that would work just fine. something like this, maybe? : $('#somelink').attr({href: 'newprependedtext' + this.href.slice(-6)}); --Karl Karl Swedbergwww.englishrules.comwww.learningjquery.com On Jul 20, 2008, at 7:52 PM, hubbs wrote: I am wondering if it is possible to use the .slice() method to keep 6 characters on the end of a URL in a href attribute, then append a new URL to the beginning? Or is there a better method to do this?
[jQuery] .click with confirm coming up multiple times
I have been working on a script, that will put a URL into a var when a link is clicked. Then, when a second link is clicked a confirm dialog appears, if you click ok, that var is printed. Problem is, it works only the first time you click one of the first links. If you click a second link, and then the link that activates the confirm, it throws 2 confirm dialogs, one for the first link, and one for the second link. How can I make the var get overwritten each time a new link is clicked? $(a.test).click(function() { var location = $(this).attr(rel); $(#test2).click(function() { var answer = confirm(Are you sure you want to delete this asset?); if (answer) { $(#textTest).text(location); } }); }); a class=test rel=http://www.microsoft.com; href=#Remove/a a class=test rel=http://www.apple.com; href=#Remove/a a id=test2 href=#Add/a div id=textTest/div
[jQuery] Re: .click with confirm coming up multiple times
I think I figured this out. I needed to unbind the click event each time a new link is clicked, so: $(a.test).click(function() { var location = $(this).attr(rel); $(#test2).unbind('click'); $(#test2).click(function() { var answer = confirm(Are you sure you want to delete this asset?); if (answer) { $(#textTest).text(location); } }); }); It seems to work how I want, is this the best method? On Jul 18, 11:09 pm, hubbs [EMAIL PROTECTED] wrote: I have been working on a script, that will put a URL into a var when a link is clicked. Then, when a second link is clicked a confirm dialog appears, if you click ok, that var is printed. Problem is, it works only the first time you click one of the first links. If you click a second link, and then the link that activates the confirm, it throws 2 confirm dialogs, one for the first link, and one for the second link. How can I make the var get overwritten each time a new link is clicked? $(a.test).click(function() { var location = $(this).attr(rel); $(#test2).click(function() { var answer = confirm(Are you sure you want to delete this asset?); if (answer) { $(#textTest).text(location); } }); }); a class=test rel=http://www.microsoft.com; href=#Remove/a a class=test rel=http://www.apple.com; href=#Remove/a a id=test2 href=#Add/a div id=textTest/div
[jQuery] Getting this to work with my function and jquery
I might be getting confused about the proper use of this. I thought I understood how this worked, and that since I am triggering the onclick even on an anchor, that the this would be in the context of that anchor tag, so that I could grab its href. Here is what I have done, but it is returning undefined for asseturl. function deleteAjaxAsset(message, assetid) { var asseturl = $(this).attr(href); alert(asseturl); var confirmDelete = confirm(message); if (confirmDelete == true) { if(action == delete) { $.ajax( { type : POST, url : asseturl + ?action=delete } ); } } } a href=http://www.testpage.com; onclick=deleteAjaxAsset('Are you sure you want to delete?','testid'); return false;Delete/a Thanks guys!
[jQuery] Re: Getting this to work with my function and jquery
Thanks for the help. I do not really want to use an inline onclick, but I am a javascript newbie, and I was unsure how to still pass the two variable to the function if I did not do it inline. How could I rewrite this so that my function will still work, but re-factoring as you say? On Jul 18, 10:14 am, Mike Alsup [EMAIL PROTECTED] wrote: On Jul 18, 12:58 pm, hubbs [EMAIL PROTECTED] wrote: I might be getting confused about the proper use of this. I thought I understood how this worked, and that since I am triggering the onclick even on an anchor, that the this would be in the context of that anchor tag, so that I could grab its href. Here is what I have done, but it is returning undefined for asseturl. function deleteAjaxAsset(message, assetid) { var asseturl = $(this).attr(href); alert(asseturl); var confirmDelete = confirm(message); if (confirmDelete == true) { if(action == delete) { $.ajax( { type : POST, url : asseturl + ?action=delete } ); } } } a href=http://www.testpage.com; onclick=deleteAjaxAsset('Are you sure you want to delete?','testid'); return false;Delete/a Thanks guys! Since you're bypassing jQuery's event framework 'this' is not automatically set to the anchor for you. You'd be better off dropping the inline onclick attributes and doing something like this: $('a').click(deleteAjaxAsset) and refactoring deleteAjaxAsset a bit to get the args via 'this'. But you could continue using onclick if you must; I think this should work: onclick=deleteAjaxAsset.call(this, 'Are you sure you want to delete?','testid'); return false;
[jQuery] Re: Getting this to work with my function and jquery
Sorry for not clarifying. action=delete is just something that I want sent through in the query string, it has nothing to do with javascript. Let me explain why I am needing this function: I have a large listing of assets that are in my system. I have created a generic delete button bellow all of these assets, which I would like to use to delete these. The way my system is set up, is you pass a specific URL, with something like action=delete and it will delete the asset at that URL. But since I only want to use that generic delete button, I need to figure out a way to click an asset, and transfer the URL, confirmation, etc. to my generic delete button. That way, I can use this for all the assets, just selection one, then click the delete button. Rather than having a seperate delete button for each asset. Here is what I was working on as a newer idea of this concept, but again, it is not seeming to work. $(#test).click(function() { var answer = confirm(Are you sure you want to delete this asset?); if (confirm == true) { $(#test2).click(function() { $.ajax( {type : POST, url : http://www.puc.edu? action=delete }); }); } }); a id=test href=#Remove/a a id=test2 href=#Add/a So, when you click remove, and you confirm, it will add a new click event to test2 and allow you to click that link to pass the URL to the system. Still working on how to pass the URL of the first clicked asset though... On Jul 18, 12:11 pm, Mike Alsup [EMAIL PROTECTED] wrote: I do not really want to use an inline onclick, but I am a javascript newbie, and I was unsure how to still pass the two variable to the function if I did not do it inline. How could I rewrite this so that my function will still work, but re-factoring as you say? You never showed us where action comes from or why assetid is needed, but here's a quick refactoring: $('a').click(deleteAjaxAsset); function deleteAjaxAsset() { var url = $(this).attr(href); if (action == delete confirm('Are yous ure you want to delete?')) { $.ajax({ type: POST, url: url + ?action=delete }); } return false; }; You could also get rid of the named function deleteAjaxAsset altogether and use an anon fn instead. But that's just a matter of style. Mike
[jQuery] Form plugin, add loading gif
I am trying to add a loading gif to the form plugin, but each time I do, it breaks. I am using: $(document).ready(function() { //Create function for ajax asset builder $('#page_asset_builder_28031').ajaxForm({ iframe: true, success: function(html) { $(#loading).show(); $(#ajaxResult).html($(html).find(#ajaxResponse)); $(#loading).hide(); }}); }); I need to get the $(#loading).hide(); statement moved up further in the script, so that it gets activated right when the submit button is clicked, rather on success, but when I create a function, and do this, it seems to not work. Any ideas?
[jQuery] Copy text onkeyup locking up browser
I am having a strange problem, where a function is freezing the browser. I have an iframe, which has an input field, and I want the text from this, to update some inner html in its parent frame. Have I don't something totally wrong here? //Add update name function $(#calendar_event_718).keyup(function () { content = $(#calendar_event_718).val(); $(#inner, top.document).html() = content; });
[jQuery] Re: Add events and functions to ajax content
Ok, so it sounds like I need to rebind when my new elements are added. Strangely the .bind() example is not even using bind. This is the example: $('a').click(fn); $('#mydiv').load('my.html',function(){ $('a').click(fn); }); Is this the best way to do what I need, or are some of the other options better for this, such as livequery? On Jul 15, 5:06 pm, Karl Swedberg [EMAIL PROTECTED] wrote: On Jul 15, 2008, at 6:47 PM, hubbs wrote: I have some html that is brought in through ajax which itself has some jquery functions attached to it. These are not working unless I include a document ready in the content that is pulled through with ajax. This in turn conflicts with my pages jquery document load. Is there a way to avoid this? This is a great question, and a frequently-asked one, too: http://docs.jquery.com/Frequently_Asked_Questions#Why_do_my_events_st... Let us know if you still need help after having read the answer. :) --Karl Karl Swedbergwww.englishrules.comwww.learningjquery.com
[jQuery] Livequery add class to new DOM elements
I am trying to get live query to work, so that it will add a new class to links that have just been added to the DOM through ajax. Something is not right though: $('a.calendarNavLink').livequery(function(){ $(this).addClass('ajax'); }); Have I done something wrong here?
[jQuery] Re: Livequery add class to new DOM elements
Ok, I realize it is working. But, for some reason it is not working with the ajaxload script. I have a feeling I have to somehow call the ajaxload from within livequery. $('a.ajax').ajaxContent({ target:'#adminToolsListing', event:'click', loaderType:'img', loadingMsg:'/__data/assets/image/0018/24345/announce- loading.gif' }); }); Any ideas on how to make the two work together? On Jul 16, 11:34 am, noon [EMAIL PROTECTED] wrote: sorry, I am incorrect. I forgot there were multiple forms. That should work On Jul 16, 2:29 pm, noon [EMAIL PROTECTED] wrote: livequery accepts two parameters, the first is the event to which a function (the 2nd parameter) is bound to. $('a.someLink').livequery('click', function() { // anchors with a class of 'someLink' // can now be dynamically inserted to the dom // yet still have an 'onclick' event associated with them // as compared to the event only being bound on document ready }); On Jul 16, 2:05 pm, hubbs [EMAIL PROTECTED] wrote: I am trying to get live query to work, so that it will add a new class to links that have just been added to the DOM through ajax. Something is not right though: $('a.calendarNavLink').livequery(function(){ $(this).addClass('ajax'); }); Have I done something wrong here?
[jQuery] Re: Livequery add class to new DOM elements
Got it: $(#calScrollTitle a) .livequery(function(){ $(this).addClass('ajax').ajaxContent({ target:'#adminToolsListing', event:'click', loaderType:'img', loadingMsg:'/__data/assets/image/0018/24345/announce- loading.gif' }); }); }); On Jul 16, 1:29 pm, hubbs [EMAIL PROTECTED] wrote: Ok, I realize it is working. But, for some reason it is not working with the ajaxload script. I have a feeling I have to somehow call the ajaxload from within livequery. $('a.ajax').ajaxContent({ target:'#adminToolsListing', event:'click', loaderType:'img', loadingMsg:'/__data/assets/image/0018/24345/announce- loading.gif' }); }); Any ideas on how to make the two work together? On Jul 16, 11:34 am, noon [EMAIL PROTECTED] wrote: sorry, I am incorrect. I forgot there were multiple forms. That should work On Jul 16, 2:29 pm, noon [EMAIL PROTECTED] wrote: livequery accepts two parameters, the first is the event to which a function (the 2nd parameter) is bound to. $('a.someLink').livequery('click', function() { // anchors with a class of 'someLink' // can now be dynamically inserted to the dom // yet still have an 'onclick' event associated with them // as compared to the event only being bound on document ready }); On Jul 16, 2:05 pm, hubbs [EMAIL PROTECTED] wrote: I am trying to get live query to work, so that it will add a new class to links that have just been added to the DOM through ajax. Something is not right though: $('a.calendarNavLink').livequery(function(){ $(this).addClass('ajax'); }); Have I done something wrong here?
[jQuery] Add events and functions to ajax content
I have some html that is brought in through ajax which itself has some jquery functions attached to it. These are not working unless I include a document ready in the content that is pulled through with ajax. This in turn conflicts with my pages jquery document load. Is there a way to avoid this?
[jQuery] Using jQuery Form Plugin - submitting special characters
I am trying to send special characters through my form, using the form plugin, but they keep on getting converted to strange characters. e.g. Smart quotes from MS Word, etc. So, what I am wondering is, what do I need to do to fix this? I thought that submitting the form into an iframe with the form plugin would fix this problem, but it doesn't seem to, still the same issue. Do I need to tell the form plugin to use the same charset that I use on my site? script type=text/javascript charset=iso-8859-1 ?
[jQuery] Filter list, not table
I have found many nice filter plugins, that let you filter a table, and hide the rest of the items, and only show the item that matches what was entered into an input dialog. What I would like to do, is use an unordered list instead. Is there any plugins that support this? I have not been able to find any..
[jQuery] jScrollPanel not always initializing in Safari
I am using jScrollPanel, and I have noticed that it does not always get initialized when the page first loads in Safari. If I refresh the page, it correctly loads up jScrollPanel. Any ideas why this might be happening? http://www.puc.edu/ Thanks!
[jQuery] Re: jScrollPanel not always initializing in Safari
Thanks Dan, I really appreciate that tip. It looks like it did the trick, and is something I would have never thought of! Nic On Jul 8, 10:53 am, Dan G. Switzer, II [EMAIL PROTECTED] wrote: $(document).ready() will not fire consistently in Safari (and I believe FF3) unless you load all the external CSS stylesheets before your JS scripts. Try moving all your link / and style / blocks above any script / tags and see if that doesn't resolve the issue. There's been talk about making it a requirement that in order for the jQuery $.ready event to work properly, you must load all external CSS first. -Dan -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Sam Sherlock Sent: Tuesday, July 08, 2008 1:41 PM To: jquery-en@googlegroups.com Subject: [jQuery] Re: jScrollPanel not always initializing in Safari i've had troubles too; I've tried $(window).ready and also tried calling it twice. with a bit of tweaking and tinkering I thought I found a solution - but then lost it 2008/7/8 hubbs [EMAIL PROTECTED]: I am using jScrollPanel, and I have noticed that it does not always get initialized when the page first loads in Safari. If I refresh the page, it correctly loads up jScrollPanel. Any ideas why this might be happening? http://www.puc.edu/ Thanks!
[jQuery] Re: Add class on click, then remove when click another, and add to that.
Thank you! This will work perfectly. Yes, I need the link to be followed, because it loads content into a div using ajax, so, removing return false; will be what i need. Any thank you for commenting the code! That really helps for beginners! On Jun 26, 1:15 am, sheshnjak [EMAIL PROTECTED] wrote: Hi, I think this should work for you: - Basically, you have this in html: div class=targetLinkList a href=1bla1/abr / a href=2bla2/abr / a href=3bla3/abr / /div - To see the results put this in your css: a.clicked {background-color: red} - And finally, you should put this in js file: $(a).click(function(){ $(.targetLinkList a.clicked).removeClass(clicked); // remove previous class if there is any $(this).addClass(clicked); // add class to the clicked link return false; // this prevents browser from following clicked link }); This should work, but I'm not sure you really asked the right question. If you omit last js line (return false;), then browser will apply clicked class, but it will follow clicked link and you will never stay on the page long enough to see the change, whatever it is you intended. If this doesn't help, give me more details and I'll try to help...http://www.tomislavdekovic.iz.hr/
[jQuery] Re: Using this with jQuery
This is almost what I need. But .seriesOverlay is not a child, but the previous div in the DOM, so it is right above it. Maybe I could use $(.seriesOverlay + .seriesItem)? On Jun 26, 2:47 am, Richard D. Worth [EMAIL PROTECTED] wrote: If your .seriesOverlay is a child of your .seriesItem[1], you can do: $(.seriesItem).mouseover(function() { $(.seriesOverlay, this).hide();}).mouseout(function() { $(.seriesOverlay, this).show(); }); Why this works: * The thisArg in jQuery callbacks is always equal to the original element to which the event is bound * The jQuery function accepts an optional context as the second argument. See http://docs.jquery.com/Core/jQuery#expressioncontext for more info. - Richard Richard D. Worthhttp://rdworth.org/ [1] If you have a different structure, you might have to do something like $(this).next(.seriesOverlay), depending On Thu, Jun 26, 2008 at 1:02 AM, hubbs [EMAIL PROTECTED] wrote: I have a listing of items, each of which has a transparent cover over each item, but when you mouse over the item, the transparency hides, and shows full color item, then on mouseout the cover is added again. This works fine if I use IDs, but I want to get away from this, as I am not always sure about how many items I will have, so I don't want to have to keep adding more IDs to my jquery script. How can I use the javascript this property, so that I can get away from using IDs, and just have the function happen on the element that the event is happening on? Here is what I am using: $(.seriesItem).mouseover(function () { $(.seriesOverlay).hide(); }); $(.seriesItem).mouseout(function () { $(.seriesOverlay).show(); }); How could I incorporate this into my script? Or am I going about it the wrong way? I wanted to use classes, but obviously it shows and hides ALL items transparent cover.
[jQuery] Re: jQuery upload progress bar, maybe for form plugin
When will jquploader2 be done? On Jun 24, 10:54 pm, Alexandre Plennevaux [EMAIL PROTECTED] wrote: On Wed, Jun 25, 2008 at 7:25 AM, hubbs [EMAIL PROTECTED] wrote: I have been reading different posts that talk about a jquery upload progress bar, but none of them gave a good solution. Is there a good solution for a upload progress bar, that can accurately progress, for file/image uploads, so that the user can see how long it is taking? Also, is there a way for the size of the upload to be calculated from the client machine, and set on the page? Similar to how a file input field shows the file name right away? you would have to use a (hidden) flash file, that's the way most upload service go (such as vimeo, gmail, etc.) i'm working on jquploader2 that will do just that. jquploader1 used a flash file also for the graphical UI, jquploader2 will let the developer customize looks and behaviours via html/Css and javascript. -- Alexandre Plennevaux LAb[au] http://www.lab-au.com
[jQuery] Using this with jQuery
I have a listing of items, each of which has a transparent cover over each item, but when you mouse over the item, the transparency hides, and shows full color item, then on mouseout the cover is added again. This works fine if I use IDs, but I want to get away from this, as I am not always sure about how many items I will have, so I don't want to have to keep adding more IDs to my jquery script. How can I use the javascript this property, so that I can get away from using IDs, and just have the function happen on the element that the event is happening on? Here is what I am using: $(.seriesItem).mouseover(function () { $(.seriesOverlay).hide(); }); $(.seriesItem).mouseout(function () { $(.seriesOverlay).show(); }); How could I incorporate this into my script? Or am I going about it the wrong way? I wanted to use classes, but obviously it shows and hides ALL items transparent cover.
[jQuery] Add class on click, then remove when click another, and add to that.
I have a list of links, and when one is clicked, I would like a class to be added. I understand how to do this, but when you click another link, I would like the class removed from the first click and added to the second click, and so on, so that there is always only one link with the class applied. Thanks!
[jQuery] jQuery upload progress bar, maybe for form plugin
I have been reading different posts that talk about a jquery upload progress bar, but none of them gave a good solution. Is there a good solution for a upload progress bar, that can accurately progress, for file/image uploads, so that the user can see how long it is taking? Also, is there a way for the size of the upload to be calculated from the client machine, and set on the page? Similar to how a file input field shows the file name right away?
[jQuery] Resizing two divs proportionally
I would like to know how I could resize two divs proportionally to each other. I have the resize UI plugin working to resize the top div, but I would like the bottom div to resize as well, depending on the resizing of the top div. (Similar to how many mail programs manage the list of mail, and viewing the mail below that). I used: $(#resizebleImage).resizable({ handles: s, proxy: proxy }); Now, I know there is a UI option called proportionallyResize, but I can find no info or help about this.
[jQuery] Access multiple URLs with ajax
I am wondering if it is possible to use the jQuery .ajax() call to access multiple URLs right after another. When I am wanting to do, is have a list of items, each of which has a check box which is an option to delete the item. If the box is checked, and the submit button clicked, I would like ajax to access each URL that pertains to the checked item, and send the query string ? action=delete.
[jQuery] Expandable Div
I am wanting to have a div that you can click your mouse on the edge of it, and then drag the bottom of the div up to make it smaller, or drag it down to make it larger. Obviously I would set it to overflow:auto so that my scroll bar would appear when needed. Does jQuery have something like this built in?
[jQuery] Re: Expandable Div
Perfect! Thank you! On Jun 16, 4:20 pm, anthonyd [EMAIL PROTECTED] wrote: You should check out jQuery UI -http://ui.jquery.comhttp://ui.jquery.com/functional_demos/#ui.resizablelooks like it should do what you want. Ant. On Jun 17, 12:09 am, hubbs [EMAIL PROTECTED] wrote: I am wanting to have a div that you can click your mouse on the edge of it, and then drag the bottom of the div up to make it smaller, or drag it down to make it larger. Obviously I would set it to overflow:auto so that my scroll bar would appear when needed. Does jQuery have something like this built in?
[jQuery] Re: Expandable Div
Does anyone know how to use the proportionallyResize? I can't find any examples. On Jun 16, 4:20 pm, anthonyd [EMAIL PROTECTED] wrote: You should check out jQuery UI -http://ui.jquery.comhttp://ui.jquery.com/functional_demos/#ui.resizablelooks like it should do what you want. Ant. On Jun 17, 12:09 am, hubbs [EMAIL PROTECTED] wrote: I am wanting to have a div that you can click your mouse on the edge of it, and then drag the bottom of the div up to make it smaller, or drag it down to make it larger. Obviously I would set it to overflow:auto so that my scroll bar would appear when needed. Does jQuery have something like this built in?
[jQuery] Re: jScrollPane - White space at bottom of scrolling div
Anyone? On Jun 10, 9:51 am, hubbs [EMAIL PROTECTED] wrote: I am using jScrollPane to have a scrollable calendar. It is made up of list items, and the height of each list item depends on how long the name of the calendar event is, so I cannot define a height for each list item. This seems to cause a problem for jScrollPane, and it leaves a large amount of white space at the bottom of my scrolling div, which makes it look bad. Giving the list items a specific height removes this problem. This is strange, because some of the examples on the jScrollPane site don't have a height. Any help on this would be appreciated, as I am confused at why this is happening!
[jQuery] Re: jScrollPane - White space at bottom of scrolling div
I figured it out. I was converting an ISO date after the scrollers were added, so the height was calculated with the long iso date, making the div higher. So, moving the convert date script before jScrollPane worked! On Jun 11, 12:20 pm, hubbs [EMAIL PROTECTED] wrote: Anyone? On Jun 10, 9:51 am, hubbs [EMAIL PROTECTED] wrote: I am using jScrollPane to have a scrollable calendar. It is made up of list items, and the height of each list item depends on how long the name of the calendar event is, so I cannot define a height for each list item. This seems to cause a problem for jScrollPane, and it leaves a large amount of white space at the bottom of my scrolling div, which makes it look bad. Giving the list items a specific height removes this problem. This is strange, because some of the examples on the jScrollPane site don't have a height. Any help on this would be appreciated, as I am confused at why this is happening!
[jQuery] jScrollPane - White space at bottom of scrolling div
I am using jScrollPane to have a scrollable calendar. It is made up of list items, and the height of each list item depends on how long the name of the calendar event is, so I cannot define a height for each list item. This seems to cause a problem for jScrollPane, and it leaves a large amount of white space at the bottom of my scrolling div, which makes it look bad. Giving the list items a specific height removes this problem. This is strange, because some of the examples on the jScrollPane site don't have a height. Any help on this would be appreciated, as I am confused at why this is happening!
[jQuery] Making normal functions work with jQuery
I have two functions that convert an ISO date into whatever date format I want. Currently I am using a document.write statement to write out each date, but I don't want to do that anymore. I want to make it unobtrusive, and have jquery find a class selector, and replace the content. So, my question is, how can I combine my functions that I already have created, and have it work with jQuery, so that it can look for a specific class, which contains the ISO date, and replace that? Date.prototype.customFormat=function(formatString){ var ,YY,,MMM,MM,M,,DDD,DD,D,hhh,hh,h,mm,m,ss,s,ampm,dMod,th; YY = ((=this.getFullYear())+).substr(2,2); MM = (M=this.getMonth()+1)10?('0'+M):M; MMM = (=[January,February,March,April,May,June,July,August,September,October,November,December] [M-1]).substr(0,3); DD = (D=this.getDate())10?('0'+D):D; DDD = (=[Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday] [this.getDay()]).substr(0,3); th=(D=10D=20)?'th':((dMod=D%10)==1)?'st':(dMod==2)?'nd': (dMod==3)?'rd':'th'; formatString = formatString.replace(##,).replace(#YY#,YY).replace(##,).replace(#MMM#,MMM).replace(#MM#,MM).replace(#M#,M).replace(##,).replace(#DDD#,DDD).replace(#DD#,DD).replace(#D#,D).replace(#th#,th); h=(hhh=this.getHours()); if (h==0) h=24; if (h12) h-=12; hh = h10?('0'+h):h; ampm=hhh12?'am':'pm'; mm=(m=this.getMinutes())10?('0'+m):m; ss=(s=this.getSeconds())10?('0'+s):s; return formatString.replace(#hhh#,hhh).replace(#hh#,hh).replace(#h#,h).replace(#mm#,mm).replace(#m#,m).replace(#ss#,ss).replace(#s#,s).replace(#ampm#,ampm); } getTFID=function(isoDate){ //GET TIME FROM ISO DATE if(isoDate.slice(-1)=='-') return ''; isoDate = isoDate.replace(/\D/g, ); var dObj = isoDate.split( ); var newDate = new Date(dObj[0], (dObj[1]-1), dObj[2], dObj[3], dObj[4], dObj[5]); return newDate.customFormat('#h#:#mm##ampm#');
[jQuery] Calculate time since post
I am wondering if jQuery has any solutions to calculate the time since a post was made. Say it was created on June 2, at 11:30pm, I would like to have the display continue to change as the days go on. So, tomorrow, it would read, posted 1 day 20 hours ago, or something like that. Has anyone had experience with this?
[jQuery] Re: Calculate time since post
Perfect!! Just what I was looking for! On Jun 2, 11:55 pm, tazman [EMAIL PROTECTED] wrote: Check this:http://ejohn.org/blog/javascript-pretty-date/
[jQuery] Re: Do something, ONLY if parent has children
Sorry for not being clear. I would like to hide H3 when next element does not have class 'calendarEvent' (Meaning, there would be another H3, if there was not a div with class 'calendarEvent' E.g.: h3Text/h3 h3Text/h3 h3Text/h3 h3Text/h3 h3Text/h3 div class=calendarEventtext/div h3Text/h3 div class=calendarEventtext/div So, the first four H3 elements need to be hidden, as the next element does not have class calendarEvent Thanks so much for the help. On May 29, 2:42 am, Wizzud [EMAIL PROTECTED] wrote: Can you be a bit more explicit about what it is that you want to do? eg. hide H1 where next element does not have class 'fred' or hide DIV, H1 and H6 where first child is not (DIV.dynamo) or hide P, H1 thru H6 where next element is not (P.kiev) or is (P.kiev having a child of A.hideme) Then we can stop trying to second guess what it is that you need. On May 29, 3:37 am, hubbs [EMAIL PROTECTED] wrote: Thank you. So, if I wanted to check to see if there even were any p tags after an h1 tag, and I wanted to hide the h1 tag, I would do the following? $('h1 + p:not(:has(*))').hide(); On May 28, 7:22 pm, Hamish Campbell [EMAIL PROTECTED] wrote: Don't forget to check the jQuery documentation:http://docs.jquery.com/ The selector you want is 'prev + next':http://docs.jquery.com/Selectors/next#prevnext Eg, if I wanted to highlight in blue every paragraph object that comes after a h1 heading: $('h1 + p').css('color', 'blue'); On May 29, 2:06 pm, hubbs [EMAIL PROTECTED] wrote: Hey guys, I realized that I misstated my problem. I realized that the item I want to check for is NOT a child, but the element that comes AFTER a specific element. So, I have a list of specific elements, and if an element with a specific class does not come after the first element, hide the first element. Sorry this sounds strange. I am trying to create a work around for my CMS. On May 28, 5:53 pm, Hamish Campbell [EMAIL PROTECTED] wrote: You can do it with selectors: $('#main:not(:has(*))').hide(); Ie - 'select the element with the id main that does _not_ contain any other element'. Note that this is different from $('#main:empty') which includes text nodes. On May 29, 12:10 pm, Michael Geary [EMAIL PROTECTED] wrote: I would do it by checking the DOM directly, just because it's reasonably straightforward and very efficient: var $main = $('#main'); if( $main[0] $main[0].firstChild ) $main.hide(); -Mike I am wondering how I could check if a parent element has children, and it it does not, I would like to hide the parent. I was looking at something like the following, but I am not sure how to get it to work how I want: $(#main *).hide;- Hide quoted text - - Show quoted text -- Hide quoted text - - Show quoted text -
[jQuery] Do something, ONLY if parent has children
I am wondering how I could check if a parent element has children, and it it does not, I would like to hide the parent. I was looking at something like the following, but I am not sure how to get it to work how I want: $(#main *).hide;
[jQuery] Re: Do something, ONLY if parent has children
Thanks Mike, Could you explain your if statement for me, what does the do? I am still learning js and jQuery. :) On May 28, 5:10 pm, Michael Geary [EMAIL PROTECTED] wrote: I would do it by checking the DOM directly, just because it's reasonably straightforward and very efficient: var $main = $('#main'); if( $main[0] $main[0].firstChild ) $main.hide(); -Mike I am wondering how I could check if a parent element has children, and it it does not, I would like to hide the parent. I was looking at something like the following, but I am not sure how to get it to work how I want: $(#main *).hide;
[jQuery] Re: Do something, ONLY if parent has children
Hey guys, I realized that I misstated my problem. I realized that the item I want to check for is NOT a child, but the element that comes AFTER a specific element. So, I have a list of specific elements, and if an element with a specific class does not come after the first element, hide the first element. Sorry this sounds strange. I am trying to create a work around for my CMS. On May 28, 5:53 pm, Hamish Campbell [EMAIL PROTECTED] wrote: You can do it with selectors: $('#main:not(:has(*))').hide(); Ie - 'select the element with the id main that does _not_ contain any other element'. Note that this is different from $('#main:empty') which includes text nodes. On May 29, 12:10 pm, Michael Geary [EMAIL PROTECTED] wrote: I would do it by checking the DOM directly, just because it's reasonably straightforward and very efficient: var $main = $('#main'); if( $main[0] $main[0].firstChild ) $main.hide(); -Mike I am wondering how I could check if a parent element has children, and it it does not, I would like to hide the parent. I was looking at something like the following, but I am not sure how to get it to work how I want: $(#main *).hide;- Hide quoted text - - Show quoted text -
[jQuery] Re: Do something, ONLY if parent has children
Thank you. So, if I wanted to check to see if there even were any p tags after an h1 tag, and I wanted to hide the h1 tag, I would do the following? $('h1 + p:not(:has(*))').hide(); On May 28, 7:22 pm, Hamish Campbell [EMAIL PROTECTED] wrote: Don't forget to check the jQuery documentation:http://docs.jquery.com/ The selector you want is 'prev + next':http://docs.jquery.com/Selectors/next#prevnext Eg, if I wanted to highlight in blue every paragraph object that comes after a h1 heading: $('h1 + p').css('color', 'blue'); On May 29, 2:06 pm, hubbs [EMAIL PROTECTED] wrote: Hey guys, I realized that I misstated my problem. I realized that the item I want to check for is NOT a child, but the element that comes AFTER a specific element. So, I have a list of specific elements, and if an element with a specific class does not come after the first element, hide the first element. Sorry this sounds strange. I am trying to create a work around for my CMS. On May 28, 5:53 pm, Hamish Campbell [EMAIL PROTECTED] wrote: You can do it with selectors: $('#main:not(:has(*))').hide(); Ie - 'select the element with the id main that does _not_ contain any other element'. Note that this is different from $('#main:empty') which includes text nodes. On May 29, 12:10 pm, Michael Geary [EMAIL PROTECTED] wrote: I would do it by checking the DOM directly, just because it's reasonably straightforward and very efficient: var $main = $('#main'); if( $main[0] $main[0].firstChild ) $main.hide(); -Mike I am wondering how I could check if a parent element has children, and it it does not, I would like to hide the parent. I was looking at something like the following, but I am not sure how to get it to work how I want: $(#main *).hide;- Hide quoted text - - Show quoted text -- Hide quoted text - - Show quoted text -
[jQuery] Accordion issues: Closes when clicking link
I am using the jQuery Accordion plugin (http://bassistance.de/jquery- plugins/jquery-plugin-accordion/) which is great. I have one problem. Inside of some of my accordion divs I have links to pdf files, external pages, etc. When you click on any of these links, it just closes the accordion, and does not take the user to the link. Was I suppose to add an extra option in order to let the script follow links?
[jQuery] Re: Accordion issues: Closes when clicking link
I figured it out. I needed to specify a header (header: 'a.accordTitle',) On May 27, 10:04 am, hubbs [EMAIL PROTECTED] wrote: I am using the jQuery Accordion plugin (http://bassistance.de/jquery- plugins/jquery-plugin-accordion/) which is great. I have one problem. Inside of some of my accordion divs I have links to pdf files, external pages, etc. When you click on any of these links, it just closes the accordion, and does not take the user to the link. Was I suppose to add an extra option in order to let the script follow links?
[jQuery] Re: Convert special characters
Well, I checked, and our website is using iso-8859-1. I see that this is a subset of utf8. Is it still possible to have js correctly uncode the characters? On May 21, 10:21 pm, Karl Rudd [EMAIL PROTECTED] wrote: That's my guess. Without seeing the web page(s) in question it's pretty hard to diagnose where exactly it's going wrong. Karl Rudd On Thu, May 22, 2008 at 3:18 PM, hubbs [EMAIL PROTECTED] wrote: Karl, So, potentially, javascript is using a different character set when posting with ajax, as opposed to a normal form post? On May 21, 6:38 pm, Karl Rudd [EMAIL PROTECTED] wrote: JavaScript uses UTF-8, you need to make sure your pages are using UTF-8 and that your back end is also expecting that. Some useful links gleaned from a Google search of javascript utf-8: http://www.meanfreepath.com/support/javascript_charsets.htmlhttp://ww.. Karl Rudd On Thu, May 22, 2008 at 10:41 AM, hubbs [EMAIL PROTECTED] wrote: I have a form, which sends text through .ajax(); using POST. But for some reason, it is making special characters into strange text. For example, when quotes are posted, ’ is received on the other end instead. Should I be using a special jquery function to convert special characters? As it seems when using a normal form post this is not a problem.
[jQuery] Re: Convert special characters
Karl, it seems to be the biggest problem when text is copied from MS Word, then sent through ajax. The quotes don't play nice. On May 21, 10:21 pm, Karl Rudd [EMAIL PROTECTED] wrote: That's my guess. Without seeing the web page(s) in question it's pretty hard to diagnose where exactly it's going wrong. Karl Rudd On Thu, May 22, 2008 at 3:18 PM, hubbs [EMAIL PROTECTED] wrote: Karl, So, potentially, javascript is using a different character set when posting with ajax, as opposed to a normal form post? On May 21, 6:38 pm, Karl Rudd [EMAIL PROTECTED] wrote: JavaScript uses UTF-8, you need to make sure your pages are using UTF-8 and that your back end is also expecting that. Some useful links gleaned from a Google search of javascript utf-8: http://www.meanfreepath.com/support/javascript_charsets.htmlhttp://ww.. Karl Rudd On Thu, May 22, 2008 at 10:41 AM, hubbs [EMAIL PROTECTED] wrote: I have a form, which sends text through .ajax(); using POST. But for some reason, it is making special characters into strange text. For example, when quotes are posted, ’ is received on the other end instead. Should I be using a special jquery function to convert special characters? As it seems when using a normal form post this is not a problem.
[jQuery] Cluetip not working because of other javascript
I was frustrated because I could not figure out why cluetip was not working. I figured out it was conflicting with another script, which makes a div scrollable, and I had the cluetip links inside of this. If I move the clue tip links, outside of the scrollable div, it works as expected. any ideas on how I could make it NOT conflict? Here is an example: http://www.puc.edu/PUC/file/cluetip.html NOTE: This file is extremely stripped down, please ignore any HTML problems. Also, the image paths to the scroll handles will be broken.
[jQuery] Re: Convert special characters
Bill, I would love to move to UTF8. Problem is, 99% of our site was created with ISO-8859-1, so when I changed it to UTF8, all and ' characters got question marks. And I am not about to go through the entire site and retype those. Not sure what that happens though. On May 22, 11:12 am, Bil Corry [EMAIL PROTECTED] wrote: hubbs wrote on 5/22/2008 12:23 PM: Karl, it seems to be the biggest problem when text is copied from MS Word, then sent through ajax. The quotes don't play nice. The curly quotes from MS Word are in the Windows-1252 character set. You're using ISO-8859-1, which does not have the curly quotes (they don't exist in ISO-8859-1). So even if you work around the UTF-8 issue, you will never get the curly quotes to work properly in ISO-8859-1 (except maybe browsers that auto-detect the charset mismatch and adjust accordingly). So at a minimum, you should change to Windows-1252 character set if you want to support the extended MS characters, but if you're going to switch, just jump to UTF-8 and call it good. - Bil
[jQuery] Scrolling div with image scroller?
I have a very old javascript implementation of a scrolling div, that has an image as the scroller, so that I can scroll a div filled with content. Here is the original script: http://meddle.dzygn.com/eng/weblog/scroller.mod/ I would really like to find a new, clean and simple jQuery solution, as the one I am using seems buggy, is a paint, and the code is bloated. Are there any plugins or jQuery solutions for this?
[jQuery] Show element onclick
I have a list of divs that I would like to display one at a time when a link is clicked. How would I do this with jQuery? a href=#Show another/a divContent 1/div div style=display:none;Content 2/div div style=display:none;Content 3/div div style=display:none;Content 4/div div style=display:none;Content 5/div div style=display:none;Content 6/div What I would like to do is reveal the next div in the list when the Show another link is clicked, allowing the user to reveal all of the divs, or just a few.
[jQuery] Re: Easy way to filter and sort a list
I need something that will filter a list that is already displayed. So, if I had a list of 100 names, I would type in the input box, and my list would start to be filtered from the list that is already there, so that I can quickly see the item(s) that match what I typed. On May 17, 1:55 am, Eric Ongerth [EMAIL PROTECTED] wrote: Have you looked athttp://plugins.jquery.com/project/autocompletex? On May 16, 11:09 pm, hubbs [EMAIL PROTECTED] wrote: Would i use .filter() for this? On May 16, 11:42 am, hubbs [EMAIL PROTECTED] wrote: I am looking for a way to easily filter, and short a list. I found the tableFilter plugin, but it is an overkill for what I need, and I don't want to use tables. I want to be able to filter a list of items, and also sort this list by ABC. I love the idea of the filtering being linked to an input box, so when you start typing something, it will filter the list, find what you are looking for, and remove the rest. Any suggestions on what I could use?
[jQuery] jQuery Column Filters Plugin Help
I just found the really great Column Filters Plugin: http://plugins.jquery.com/project/ColumnFilters Right now, you can only use it with tables, and, the tern you are filter with, has to be the first thing within the td, so, if you wanted to use a span inside, or a link this won't work. I am interested in modifying it so that I can use it with lists, rather than tables, and also allot other markup to be with in the li tag. Has anyone used this plugin before? Here is an example from the code, that I would like to modify: function runFilters(event) { $('input._filterText', obj).each( function(iColCount) { var wildCardPatt = new RegExp(regexEscape(settings.wildCard),'g'), sFilterTxt = (!settings.wildCard) ? regexEscape(this.value) : regexEscape(this.value, settings.wildCard).replace(wildCardPatt, '.*'), bMatch = true; if (settings.notCharacter sFilterTxt.indexOf(regexEscape(settings.notCharacter)) === 0) { sFilterTxt = sFilterTxt.substr(regexEscape(settings.notCharacter).length,sFilterTxt.length); if (sFilterTxt.length 0) { bMatch = false; } } if (sFilterTxt.length settings.minSearchCharacters) { sFilterTxt = ''; } sFilterTxt = sFilterTxt || '.*'; sFilterTxt = '^' + sFilterTxt + '.*'; $('tbody:first tr', obj).each( function() { $('td', this).each( function(iCellCount) { if (iCellCount === iColCount) { var filterPatt = (settings.caseSensitive) ? new RegExp(sFilterTxt) : new RegExp(sFilterTxt,i); $(this).removeClass('_match'); if (filterPatt.test($(this).text()) === bMatch) { $(this).addClass('_match'); } } } ); } ); } );
[jQuery] Fake ajax load
I need to load a page into an iframe, but I would like to have jquery show a loading gif while the data is loading into the iframe. Is it possible, similar to loading ajax, that I can load the gif, only until the page is loaded, then hide it?
[jQuery] Re: Fake ajax load
This looks interesting. But the reason I need to use an iframe, is to get a wysiwyg to work. Wouldn't this defeat this purpose, as it is still loading it through ajax? On May 19, 8:45 pm, Karl Rudd [EMAIL PROTECTED] wrote: Try the frameready pluginhttp://ideamill.synaptrixgroup.com/?p=6 Karl Rudd On Tue, May 20, 2008 at 1:32 PM, hubbs [EMAIL PROTECTED] wrote: I need to load a page into an iframe, but I would like to have jquery show a loading gif while the data is loading into the iframe. Is it possible, similar to loading ajax, that I can load the gif, only until the page is loaded, then hide it?
[jQuery] Re: Easy way to filter and sort a list
Would i use .filter() for this? On May 16, 11:42 am, hubbs [EMAIL PROTECTED] wrote: I am looking for a way to easily filter, and short a list. I found the tableFilter plugin, but it is an overkill for what I need, and I don't want to use tables. I want to be able to filter a list of items, and also sort this list by ABC. I love the idea of the filtering being linked to an input box, so when you start typing something, it will filter the list, find what you are looking for, and remove the rest. Any suggestions on what I could use?
[jQuery] Easy way to filter and sort a list
I am looking for a way to easily filter, and short a list. I found the tableFilter plugin, but it is an overkill for what I need, and I don't want to use tables. I want to be able to filter a list of items, and also sort this list by ABC. I love the idea of the filtering being linked to an input box, so when you start typing something, it will filter the list, find what you are looking for, and remove the rest. Any suggestions on what I could use?
[jQuery] Highlight code WITHIN a textarea?
Is there a way to highlight code within a textarea block? It would be nice to be able to color code the text, as we have a large textarea that html and javascript is added to. I was looking at using Chili, but it does not seem this would work.
[jQuery] Re: Var in through ajax, then copy to field
Thanks Karl, yes, I am using the form plugin on the second form for image upload. On May 15, 12:32 am, Karl Rudd [EMAIL PROTECTED] wrote: I think I see now. You should be able to parse the response (the 'data' argument from the sucess function) that you get back from the ajax call and filter out the ID. For instance, if the response is as follows: htmlbody !-- id=1231234 -- pThank you/p /body/html You could do something like this (untested): $('#myform').ajaxForm( function(data) { var imageLoc = data.exec(/!-- id=(\d+) --/); if ( imageLoc ) $(#create_image_location).val( imageLoc[0] ); // ... }); I'm assuming, based on your other emails, that you're using the Form Plugin. Karl Rudd On Thu, May 15, 2008 at 3:18 PM, hubbs [EMAIL PROTECTED] wrote: Karl, this isn't possible, as it is part of an Administration Interface that I am building. Basicly, an ID number gets generated on a Thank you page of a form, this page, along with the ID is pulled into another page using ajax. This second page, uses that ID as a location to create an image. So, I somehow need to pass that ID, which is in a var, into that second form. Let me know if I can be more descriptive. On May 14, 10:03 pm, Karl Rudd [EMAIL PROTECTED] wrote: It'd be easier if you could provide a link to a live page. It's a bit hard to know exactly what you're trying to do. Karl Rudd On Thu, May 15, 2008 at 2:56 PM, hubbs [EMAIL PROTECTED] wrote: I have a variable that is set on another page, and then is brought through ajax into another page. On that page, I would like to copy that variable into an input field. I thought I had the code correct, but for some reason, it is not working. script type=text/javascript function setImageLocation() { var imageLocation = 1234; $(#create_image_location).val() = imageLocation; } /script Also, is there a way to copy the the value to the input field, right when it is brought in through ajax? Or do I HAVE to copy it with an event?