[jQuery] How to Add A Callback Function to a plugin
How do I add a callback function to a plugin so that i can execute another function after the plugin completes its own processes. Thanks in advance.
[jQuery] Re: Removing element from DOM after animate
So is there a way I can execute the slide-fade effect, then remove the element from DOM after the animation? On Jul 31, 12:06 pm, waseem sabjee wrote: > here is a chain of animation > $(this).parents(".leftbox:first") > .animate({opacity: 0.5}, 350) > .animate({opacity: 0}, 350) > .remove(); > > you are actually chaining your events to occur one after the other on a > specific element or group of elements > > in the first piece of code you shared you. it would want to remove the > element as it animates, not after. > > On Fri, Jul 31, 2009 at 5:59 PM, bittermonkey wrote: > > > Please tell me why the remove() doesn't work from this call: > > $(this).parents(".leftbox:first").animate({height:"hide", > > opacity:"hide"}, 350, "", function(){$(this).remove()}); > > > while this one works: > > $(this).parents(".leftbox:first").animate({height:"hide", > > opacity:"hide"}, 350).remove(); > > > Thanks in advance.
[jQuery] Removing element from DOM after animate
Please tell me why the remove() doesn't work from this call: $(this).parents(".leftbox:first").animate({height:"hide", opacity:"hide"}, 350, "", function(){$(this).remove()}); while this one works: $(this).parents(".leftbox:first").animate({height:"hide", opacity:"hide"}, 350).remove(); Thanks in advance.
[jQuery] Re: Get the HTML of the current node plus its Inner HTML
Theordore, The function worked like a charm. Thanks man and for everyone who pitched in. On Jul 16, 5:11 pm, Theodore Ni wrote: > I was going to work on a proof of concept, but then I had the idea to see if > anyone else has already implemented this. Sure enough, Brandon Aaron > has:http://brandonaaron.net/blog/2007/06/17/jquery-snippets-outerhtml > <http://brandonaaron.net/blog/2007/06/17/jquery-snippets-outerhtml> > Ted > > On Thu, Jul 16, 2009 at 3:06 PM, bittermonkey wrote: > > > Hi, > > > I need to get all the TABLE HTML code within the tag for a > > content-generating application. I'm trying to use the html() method, > > but it only gets the inner HTML. I also tried clone(), but does the > > same thing. Or maybe I'm using it wrong. Here's an example to clarify > > what I wanted to do: > > > Input > > > > > > some text > > > table> > > ... > > > table> > > > > > Output > > > > > table> > > > table> > > > jQuery Code > > > > $("body").children().each(function(){ > > var contentHtml = ""; > > if(this.nodeName.toLowerCase() == "table") > > { > > //need to include the code here > > contentHtml += $(this).html(); > > } > > }); > > > Thanks in advance.
[jQuery] Get the HTML of the current node plus its Inner HTML
Hi, I need to get all the TABLE HTML code within the tag for a content-generating application. I'm trying to use the html() method, but it only gets the inner HTML. I also tried clone(), but does the same thing. Or maybe I'm using it wrong. Here's an example to clarify what I wanted to do: Input some text ... Output jQuery Code $("body").children().each(function(){ var contentHtml = ""; if(this.nodeName.toLowerCase() == "table") { //need to include the code here contentHtml += $(this).html(); } }); Thanks in advance.
[jQuery] Re: JQquery Ajax call WCF remotely doesn't work
Are you getting the "Access to restriced URI denied" error? If you are, here's my old post: http://groups.google.com/group/jquery-en/browse_thread/thread/b6579cd6f6c0a160/5e163538fcb0c139?hl=en&lnk=gst&q=brakes2k3#5e163538fcb0c139 Otherwise, you can try removing "http://localhost:3314"; from the url parameter. On Jun 1, 11:57 am, NH wrote: > I am trying to use JQuery Ajax to call WCF, but it seems it doesn't > recoginze the path. Here is my code: > > $.ajax({ type: "GET", > url: "http://localhost:3314/WCFServiceEx/Service.svc/ > GetData", > contentType: "application/json; charset=utf-8", > dataType: "jsonp", > // data: '{"PatientID":"' + PatientID + '","PageName": > "Desktop","WidgetOrder1":"' + hdnCol1.value + '","WidgetOrder2":"' + > hdnCol2.value + '","WidgetOrder3":"' + hdnCol3.value + > '","WidgetOrder4":"' + hdnCol4.value + '","WidgetOrder5":"' + > hdnCol5.value + '","WidgetOrder6":"' + hdnCol6.value + '" }', > success: function(data) { > alert(data.d); > }, > error: function(xhr) { > if (xhr.responseText) { > alert("text"); > $("body").html(xhr.responseText); > } > else > alert('unknown error'); > return; > }, > cache: false > }); > } > > Any suggestion? > > Thanks, > NH
[jQuery] Re: Best book to learn jQuery?
Best book for me were jQuery In Action and Learning jQuery. On May 18, 3:37 pm, alex wrote: > Ah. I'm sure this sounds dunce-y because 'jQuery does it for me', but > is a solid grounding in Javascript necessary to a solid grounding in > jQuery (or at least, being able to use jQuery), or just good > practice? > > I would guess, as a complete novice, that just using what is already > available may not require pure JS knowledge, but more advanced things > like building plugins would? I assume then that 'Learning jQuery' > would not be the first port of call for me? > > On May 18, 2:55 pm, mdk wrote: > > > Yes, but because he has no JS he will like have a tough time. I would > > read a basic JS book first, then go for Learning jQuery 1.3. > > > Mike > > > On May 18, 8:35 am, Karl Swedberg wrote: > > > > I've heard Learning jQuery 1.3 is a great read, too. ;-) > > > > --Karl > > > > > > > Karl Swedbergwww.englishrules.comwww.learningjquery.com > > > > On May 18, 2009, at 9:07 AM, MorningZ wrote: > > > > > I always recommend "jQuery in Action" it's a great read > > > > > On May 18, 3:19 am, alex wrote: > > > >> Just wondering what your opinions are on the best book out there, for > > > >> a beginner, to learn jQuery? I know HTML and CSS well enough, but > > > >> have > > > >> no javascript knowledge. > > > > >> Thanks
[jQuery] Re: Calling ASMX from JQuery
Check in Firebug if the service returns data or a 501 error. Its under CONSOLE. You should allow it to "Show XMLHTTPRequests" Also, 1. The URL part seems to have an extra space after HTTP.. or maybe its just a typo: url: "http: //localhost/BoATransformation/Survey.asmx/ GetSurvey" 2. Or try removing "http://localhost totally On May 18, 3:30 pm, ebeworld wrote: > Hi, > > I am trying to call ASMX method from JQuery without success. Following > is my code and don't understand what i am missing. > > Thanks, > Ebe > > ///Something.js > function setQuestion() { > $.ajax({ > type: "POST", > data: "{}", > dataType: "json", > url: "http: //localhost/BoATransformation/Survey.asmx/ > GetSurvey", > contentType: "application/json; charset=utf-8", > success: onSuccess > }); > > } > > function onSuccess(msg) { > $("#questionCxt").append(msg); > > } > > ///SomethingElse.cs > > [WebService(Namespace = "http://tempuri.org/";)] > [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] > [System.Web.Script.Services.ScriptService] > public class Survey : System.Web.Services.WebService { > > public Survey () { > > } > > [WebMethod] > [ScriptMethod(UseHttpGet = true)] > public string GetSurvey() { > return "Question: Who is Snoopy?"; > } > > }
[jQuery] Re: How To Get Around: Access to restricted URI denied" code: "1012
I won't be able to rewrite the service cause we also have cold fusion sites consuming the xml data. I guess I am stuck with creating another asp.net page that will call the service. Thanks for helping out everyone. On May 5, 9:16 pm, 丁亮 wrote: > use jsoncallback=? in the end of url
[jQuery] Re: How To Get Around: Access to restricted URI denied" code: "1012
I was wondering if I have another option without going this route? On May 5, 5:08 pm, James wrote: > What about going through a proxy (e.g. a PHP script that fetches the > XML content from wcf.mstsc.com domain) hosted on your current domain? > > On May 5, 11:01 am, bittermonkey wrote: > > > Hi, > > > Here's my code: > > > $.ajax({ > > type: "GET", > > url: "http://wcf.msts.com/WcfService.svc/ > > GetSponsorSearch?keyword=tr&eventsessionid=2", > > dataType: "xml", > > success: function(xml) { > > alert(xml); > > } > > }); //end ajax call > > > I know this is a cross-domain issue but I can't get away with our > > current network setup. wcf.mstsc.com is where all our web services > > reside. Is there a way I can make the ajax method work, using XML as > > the return data type, if it's in a different domain? I'm open to a > > different jquery method (as long as it returns XML) if there is one. > > > Thanks in advance.
[jQuery] How To Get Around: Access to restricted URI denied" code: "1012
Hi, Here's my code: $.ajax({ type: "GET", url: "http://wcf.msts.com/WcfService.svc/ GetSponsorSearch?keyword=tr&eventsessionid=2", dataType: "xml", success: function(xml) { alert(xml); } }); //end ajax call I know this is a cross-domain issue but I can't get away with our current network setup. wcf.mstsc.com is where all our web services reside. Is there a way I can make the ajax method work, using XML as the return data type, if it's in a different domain? I'm open to a different jquery method (as long as it returns XML) if there is one. Thanks in advance.
[jQuery] Re: Overlay not working on jquery-ui-personalized-1.6rc6.min.js
Yep just figured that out. Thanks. Sorry I posted on the wrong group. On Feb 26, 1:35 pm, "Richard D. Worth" wrote: > The overlay in 1.6rc6/1.7 is no longer specified as an option, but is part > of the jQuery UI CSS Framework. If you have a jQuery UI Theme, it will have > a default overlay style which you can modify or overide, using css in a > stylesheet, rather than in js. > > If you need any further help, please note there's a dedicated jQuery UI > list: > > http://groups.google.com/group/jquery-ui > > Thanks. > > - Richard > > On Thu, Feb 26, 2009 at 12:33 PM, bittermonkey wrote: > > > This is my code: > > > --- > > > > > > > > $(function(){ > > /* Modal Dialog Box Configuration */ > > $("#addproductsForm").dialog({ > > bgiframe: true, > > autoOpen: true, > > modal: true, > > overlay: { > > backgroundColor: "#000", > > opacity: 0.5 > > }, > > position: "center", > > dialogClass: "insertForm", > > closeable: false > > }); > > }); > > > > > --- > > > The funny thing is if i downgrade the jquery and UI files to versions > > 1.2.6 and 1.5.3 respectively, the overlay works but IE throws a > > javascript error. Thanks a lot.
[jQuery] Re: How to Open Modal Dialog box on button click?
Fixed this. File versioning problem. On Feb 26, 10:04 am, bittermonkey wrote: > Once "btnAddSession" button is clicked, the div with the > "addproductsForm" ID should open as a modal dialog box. In Firefox it > opens properly while in IE it submits the page even with return false; > > HTML > --- > Products > > > > > id="btnAddSession" /> > > > > > > Product Name: > id="txtProductName" / > > > > Product Price: > id="txtProductPrice" / > > > > > id="btnAddProduct"/> > > > > > Javascript > - > $(function(){ > /* Modal Dialog Box Configuration */ > $("#addproductsForm").dialog({ > bgiframe: true, > autoOpen: false, > modal: true, > overlay: { > "background-color": "#000", > "opacity": "0.5", > "-moz-opacity": "0.5" > }, > position: "center", > dialogClass: "insertForm", > closeable: false > }); > > $("#btnAddSession").click(function(event){ > $("#addproductsForm").dialog("open"); > //event.preventDefault(); > return false; > }); > > });
[jQuery] Re: preventing redirection when opening modal dialog box
Nevermind, this was a versioning problem on the jquery and ui plugin javascript files. On Feb 24, 11:35 am, bittermonkey wrote: > Yep I am. I event tried event.stopPropagation() but still the same > thing. Can I say I hate IE? > > On Feb 24, 10:26 am, Hector Virgen wrote: > > > Are you passing the event to the function? > > $("#btnAddSession").click(function(event){ > > // ... // > > event.preventDefault();}); > > > -Hector > > > On Tue, Feb 24, 2009 at 6:48 AM, bittermonkey wrote: > > > > Steve, yes I did try to use , , and > > > but to no success. > > > > Hector, it still does the same thing even with the preventDefault() > > > method in place. > > > > On Feb 23, 11:43 pm, Hector Virgen wrote: > > > > Try preventing the default action of the event: > > > > $("#btnAddSession").click(function(event){ > > > > $("#addproductsForm").dialog("open"); > > > > event.preventDefault(); // prevents the link from being followed > > > > > }); > > > > > -Hector > > > > > On Mon, Feb 23, 2009 at 7:01 PM, Steven Yang > > > wrote: > > > > > have you tried changing the type of btnAddSession from submit to > > > button?
[jQuery] Overlay not working on jquery-ui-personalized-1.6rc6.min.js
This is my code: --- $(function(){ /* Modal Dialog Box Configuration */ $("#addproductsForm").dialog({ bgiframe: true, autoOpen: true, modal: true, overlay: { backgroundColor: "#000", opacity: 0.5 }, position: "center", dialogClass: "insertForm", closeable: false }); }); --- The funny thing is if i downgrade the jquery and UI files to versions 1.2.6 and 1.5.3 respectively, the overlay works but IE throws a javascript error. Thanks a lot.
[jQuery] How to Open Modal Dialog box on button click?
Once "btnAddSession" button is clicked, the div with the "addproductsForm" ID should open as a modal dialog box. In Firefox it opens properly while in IE it submits the page even with return false; HTML --- Products Product Name: Product Price: Javascript - $(function(){ /* Modal Dialog Box Configuration */ $("#addproductsForm").dialog({ bgiframe: true, autoOpen: false, modal: true, overlay: { "background-color": "#000", "opacity": "0.5", "-moz-opacity": "0.5" }, position: "center", dialogClass: "insertForm", closeable: false }); $("#btnAddSession").click(function(event){ $("#addproductsForm").dialog("open"); //event.preventDefault(); return false; }); });
[jQuery] Re: preventing redirection when opening modal dialog box
Yep I am. I event tried event.stopPropagation() but still the same thing. Can I say I hate IE? On Feb 24, 10:26 am, Hector Virgen wrote: > Are you passing the event to the function? > $("#btnAddSession").click(function(event){ > // ... // > event.preventDefault();}); > > -Hector > > On Tue, Feb 24, 2009 at 6:48 AM, bittermonkey wrote: > > > Steve, yes I did try to use , , and > > but to no success. > > > Hector, it still does the same thing even with the preventDefault() > > method in place. > > > On Feb 23, 11:43 pm, Hector Virgen wrote: > > > Try preventing the default action of the event: > > > $("#btnAddSession").click(function(event){ > > > $("#addproductsForm").dialog("open"); > > > event.preventDefault(); // prevents the link from being followed > > > > }); > > > > -Hector > > > > On Mon, Feb 23, 2009 at 7:01 PM, Steven Yang > > wrote: > > > > have you tried changing the type of btnAddSession from submit to > > button?
[jQuery] Re: preventing redirection when opening modal dialog box
Steve, yes I did try to use , , and but to no success. Hector, it still does the same thing even with the preventDefault() method in place. On Feb 23, 11:43 pm, Hector Virgen wrote: > Try preventing the default action of the event: > $("#btnAddSession").click(function(event){ > $("#addproductsForm").dialog("open"); > event.preventDefault(); // prevents the link from being followed > > }); > > -Hector > > On Mon, Feb 23, 2009 at 7:01 PM, Steven Yang wrote: > > have you tried changing the type of btnAddSession from submit to button?
[jQuery] Re: preventing redirection when opening modal dialog box
No Karl. I checked it and there's no duplicate. Here's the html code: - Products Product Name: Product Price: - Here is the form tag to give you more idea for reference: - - So after clicking button#btnAddSession, div#addproductsForm should popup as a modal dialog box. Thanks again. On Feb 23, 2:01 pm, Karl Swedberg wrote: > Without seeing the page, it's a little hard to guess, but is it > possible that you have more than one element with either an id or a > name of "btnAddSession"? > > --Karl > > > Karl Swedbergwww.englishrules.comwww.learningjquery.com > > On Feb 23, 2009, at 12:56 PM, bittermonkey wrote: > > > > > hi, > > > I have this snippet which works fine in Firefox but not in IE6/7. > > Somehow in IE instead of opening the modal dialog box, it gets posted > > to the submit page when the button with "btnAddSession" Id gets > > clicked. > > > $("#btnAddSession").click(function(){ > > $("#addproductsForm").dialog("open"); > > return false; > > }); > > > FYI: I also tried converting from button to link. It works in IE but > > it throws a javascript error on click. Thanks in advance.
[jQuery] preventing redirection when opening modal dialog box
hi, I have this snippet which works fine in Firefox but not in IE6/7. Somehow in IE instead of opening the modal dialog box, it gets posted to the submit page when the button with "btnAddSession" Id gets clicked. $("#btnAddSession").click(function(){ $("#addproductsForm").dialog("open"); return false; }); FYI: I also tried converting from button to link. It works in IE but it throws a javascript error on click. Thanks in advance.
[jQuery] Re: How do I get the index of the currently clicked textbox?
Stephan, that was a good suggestion but I'm trying to minimize HTML code because the page I am working on is asp.net. That's a useful trick to know. Mauricio it worked like a charm. Thank you so much. If you don't mind, can you briefly explain why function(i) seems to know the element's index? On Feb 2, 3:08 pm, "Mauricio \(Maujor\) Samy Silva" wrote: > Try: > > $('input[type=text]').each(function(i) { > $(this).click(function() { > alert(i); > }); > }); > > Maurício > > -Mensagem Original- > De: "bittermonkey" > Para: "jQuery (English)" > Enviada em: segunda-feira, 2 de fevereiro de 2009 17:47 > Assunto: [jQuery] How do I get the index of the currently clicked textbox? > > > > > Hi, > > > How do I get the index of the currently clicked textbox? I have 5 > > textboxes in a form, all of which I am binding a click event. Here is > > the code: > > > $("#associate-form input[type=text]").bind("click", function() > > { > > alert(this); //what is its index position from the 5 > > other textboxes? > > }); > > > Thanks in advance.
[jQuery] How do I get the index of the currently clicked textbox?
Hi, How do I get the index of the currently clicked textbox? I have 5 textboxes in a form, all of which I am binding a click event. Here is the code: $("#associate-form input[type=text]").bind("click", function() { alert(this); //what is its index position from the 5 other textboxes? }); Thanks in advance.
[jQuery] Re: Highlight onKeyUp using Cursor Keys
and to find out which element was selected, I have to check for its background? Is that right? On Jan 23, 4:49 pm, jay wrote: > You could write something yourself fairly easily. Just update the > backgroundColor css property when you press the up/down keys on your > absolutely positioned element, and when you press enter perform an > action that is associated with that element. > > On Jan 23, 4:32 pm, bittermonkey wrote: > > > The code is a bit overwhelming for just the highlight functionality. > > Thanks anyway. > > > On Jan 23, 4:17 pm, jay wrote: > > > > Here is a jquery autocomplete plugin I googled and seems to do what > > > you want: > > > >http://www.pengoworks.com/workshop/jquery/autocomplete.htm > > > > On Jan 23, 4:00 pm, bittermonkey wrote: > > > > > How do I initialize a hover on a tag using cursor keys in > > > > jQuery? It's similar to how google highlights its autocomplete > > > > results. So, from google.com, type the letter "a" in the searchbox > > > > then press the Down Arrow Key and notice how the first item in the > > > > autocomplete box gets highlighted and so on if you continue pressing > > > > it. > > > > > How do I accomplish this in jQuery?- Hide quoted text - > > > - Show quoted text -
[jQuery] Re: Highlight onKeyUp using Cursor Keys
The code is a bit overwhelming for just the highlight functionality. Thanks anyway. On Jan 23, 4:17 pm, jay wrote: > Here is a jquery autocomplete plugin I googled and seems to do what > you want: > > http://www.pengoworks.com/workshop/jquery/autocomplete.htm > > On Jan 23, 4:00 pm, bittermonkey wrote: > > > How do I initialize a hover on a tag using cursor keys in > > jQuery? It's similar to how google highlights its autocomplete > > results. So, from google.com, type the letter "a" in the searchbox > > then press the Down Arrow Key and notice how the first item in the > > autocomplete box gets highlighted and so on if you continue pressing > > it. > > > How do I accomplish this in jQuery?
[jQuery] Highlight onKeyUp using Cursor Keys
How do I initialize a hover on a tag using cursor keys in jQuery? It's similar to how google highlights its autocomplete results. So, from google.com, type the letter "a" in the searchbox then press the Down Arrow Key and notice how the first item in the autocomplete box gets highlighted and so on if you continue pressing it. How do I accomplish this in jQuery?
[jQuery] Re: Unable To Traverse From an XML Ajax Response
yep that's it. On Jan 22, 4:23 pm, jay wrote: > Perhaps "table" is case-sensitive? > > On Jan 22, 3:53 pm, bittermonkey wrote: > > > Hi, > > > I need to know where I am doing wrong. The ALERT message in my jquery > > code doesn't seem to get hit when I put a breakpoint in firebug. The > > plan is to loop through all the Elements in the XML response > > and create a 3-column HTML table from its child nodes. Thanks in > > advance. > > > This is my jQuery Code >> Where CategoriesList is a .NET dropdown > > control: > > - > > $(function(){ > > var selectid = "#" + '<%= CategoriesList.ClientID > > %>' > > $(selectid).change(function(){ > > $.ajax({ > > url: "http://localhost/ws/JQService.asmx/ > > GetCategories", > > type: "POST", > > data: "categoryid=" + category, > > dataType: "xml", > > success: function(xml){ > > $(xml).find("table").each(function(){ > > alert("message"); > > }); > > } > > }); > > }); > > }); > > > This is the XML returned by my web service: > > --- > > > > > > > > 16 > > Pavlova > > 17.4500 > > > > > > 19 > > Teatime Chocolate Biscuits > > 9.2000 > > > >
[jQuery] Unable To Traverse From an XML Ajax Response
Hi, I need to know where I am doing wrong. The ALERT message in my jquery code doesn't seem to get hit when I put a breakpoint in firebug. The plan is to loop through all the Elements in the XML response and create a 3-column HTML table from its child nodes. Thanks in advance. This is my jQuery Code >> Where CategoriesList is a .NET dropdown control: - $(function(){ var selectid = "#" + '<%= CategoriesList.ClientID %>' $(selectid).change(function(){ $.ajax({ url: "http://localhost/ws/JQService.asmx/ GetCategories", type: "POST", data: "categoryid=" + category, dataType: "xml", success: function(xml){ $(xml).find("table").each(function(){ alert("message"); }); } }); }); }); This is the XML returned by my web service: --- 16 Pavlova 17.4500 19 Teatime Chocolate Biscuits 9.2000
[jQuery] Re: Selector Question
Got it. Thanks Mike. So this code would have made better sense: $("button:first").click(function(event){alert(this);}) On Jan 13, 5:52 pm, "Michael Geary" wrote: > Do you have Firebug? If not, get it and enable the Console and Script tabs, > then enter these statements into the console input line, one at a time with > Enter after each one: > > $("button") > > $("button")[0] > > $( $("button")[0] ) > > Each one will log an object to the console log. Click on each of these > objects to look at its properties. > > You'll find that the first one is a jQuery object - which happens to be an > array of DOM elements. Take the [0] of that object, as in the second > expression, and now you have the first DOM element in that array. Since it's > not a jQuery object, it doesn't have a .bind() method. Instead, it has the > properties and methods of any other DOM element. > > Now wrap the whole thing in another $() function call, as in the third > expression, and you're creating a new jQuery object that happens to contain > the same DOM element as the first one. > > -Mike > > > From:bittermonkey > > > I'm fairly new to the framework and I've been messing around a bit. > > These below confuses me. > > > 1. Why is this snippet not working? Firefox's error console > > throws an error saying < $("button")[0].bind is not a > > function > $("button")[0].bind("click", function(event){alert(this)}); > > > 2. And why does this work? > > $($("button")[0]).bind("click", function(event){alert(this)});
[jQuery] Selector Question
I'm fairly new to the framework and I've been messing around a bit. These below confuses me. 1. Why is this snippet not working? Firefox's error console throws an error saying < $("button")[0].bind is not a function > $("button")[0].bind("click", function(event){alert(this)}); 2. And why does this work? $($("button")[0]).bind("click", function(event){alert(this)});
[jQuery] Selector Question
Why does this work? $($("button")[0]).bind("click", function(event){return AlertOnClick (this + " not " + $("button")[0]);}); And why does this DOESN'T? $("button")[0].bind("click", function(event){return AlertOnClick(this + " not " + $("button")[0]);});