[jQuery] Re: pass different IDs to function?
HI,var preId = null; function divFlip(Id) { $("#"+preId).hide(); $("#"+id).show(); preId = Id; $(".tabs").removeClass("highlight"); $("#1").addClass("highlight"); } Div One Div Two Div Three try out this, now u have two id i.e. new id by as a parameter & another one is in global var. hope this is you want :) cheers. On Wed, Aug 19, 2009 at 3:33 AM, Laura wrote: > > Hi all.I'm very new at jQuery, and I've gotten myself stuck.I > have a set of menu tabs which should show/hide divs on the page, and > the active tab should change style. So far I have been able to write > the following, which does exactly what I want it to: > > function divFlip() > { >$(".hiding").hide(); > $("#div1").show(); >$(".tabs").removeClass("highlight"); >$("#1").addClass("highlight"); > } > > which I've called from an onclick in the tab. (I know that's not > recommended; I'll get to that.) > > My problem has come in expanding that to affect all the tabs/divs. I > can't figure out how to put a variable ID into the thing, so that I > can have the function work on #div2/#2, #div3/#3, etc. > > I have tried to do a click(function()) that sends (this).attr(id) as a > variable from the tab clicked on to the function as $("#div" + > variable), thus: > > (".tabs").click( function(){ > var number = $(this).attr("id"); > $(".hiding").hide(); > $("#div"+ number).show(); > $(".tabs").removeClass("highlight"); > $(this).addClass("highlight"); > }); > > which *DID* work. However, when I changed over from using the > onclick to the click(fn), it no longer worked on the first click -- I > have to double-click on the tabs in order to trigger the show/hide > behavior. How can I: > > a) make the click(fn) not need a double-click to work > or > b) modify the divFlip function called onclick to work for all tabs/ > divs? > > html below, stripped down to its bare-bones form for testing: > > >Div > One >Div Two >Div Three > > > > > > This is div 1 > > > This is div 2 > > > This is div 3 > > -- Regard Mohammad.Tareque
[jQuery] Re: Issues with readying function - shorthand works, longhand doesn't
does this work? jQuery().ready(function(){ alert("Hey!"); }); On Aug 18, 8:16 pm, Anna wrote: > Hi there :) > > At work, I'm trying to implement some jQuery on the intranet, which > runs on a Java framework (Liferay). I'm having some issues, and I've > narrowed it down to being the difference between the two ready > (function) calls. > > This version of the call WORKS: > > jQuery(function(){ > alert("Hey!"); > }); > > This version of the call DOES NOT WORK: > > $(document).ready(function(){ > alert("Hey!"); > }); > > Um what?! > > If I try to add parameters to the functions, no jQuery functionality > works on the page at all. > > In my local version, which links to the jquery.js of Liferay, > everything works. When I use the exact same code within Liferay, it > doesn't work. This leads me to believe that there's something in their > code that for some reason disallows the use of the longhand ready > functionality, and parameters? Is this possible? Are there other > reasons this might happen? > > I have asked Liferay directly for their assistance with this, but > haven't had a reply, so I'm hoping that one of the fabulous folk here > might have come across a similar issue. > > You might be able to tell that this isn't entirely my forte, and I'd > appreciate any assistance :) > > Anna
[jQuery] Re: .replaceWith Issue
IE doesn't handle custom elements well, make them all s or s and it should be fine. Or if you need to keep it that way, try putting this before all scripts: if( $.browser.msie ){ $.each('Name,Role,Interests,Words'.split(','), function(){ document.createElement(this); }); }; creating an element with the custom tagnames at load forces IE to recognize them for some reason. On Aug 18, 7:21 pm, Matthew Wehrle wrote: > Hey guys, > > I'm having a bit of an issue with the site I'm building at the moment. > It's currently underhttp://www.swfmania.co.uk/dotcommonwith the CSS > athttp://www.swfmania.co.uk/dotcommon/style.cssand the relevant > jQuery file athttp://www.swfmania.co.uk/dotcommon/tabs.js > > If you're using Firefox or Chrome you'll see that upon clicking the > tabs, the image and text all changes. Happy days. However in Internet > Explorer the text doesn't change, it merely adds onto itself (This > will be a lot clearer if you check it out on the site.) > > Just wondering if anyone has any thoughts? > > Thanks, Matt :D
[jQuery] Re: form.bind("submit") firing only once in firefox 3.5 ubuntu
Are you using any ajax after you submit the form the first time? Thanks, Anoop On Tue, Aug 18, 2009 at 10:07 AM, Dmitriy Likhten wrote: > > I have tested this on jQuery 1.2.6 and 1.3.2... After binding a > form.submit event and returning false due to some logic, the second > time the form is submitted, the event never executes and false is > automatically used by the browser. > > Has anyone else experienced this? Is this a browser bug vs a jQuery > bug? >
[jQuery] Re: Add post to "My favorites" page
So do you just want to load a form when one of those links is clicked? -Original Message- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of Vladimir Sent: Tuesday, August 18, 2009 10:47 AM To: jQuery (English) Subject: [jQuery] Add post to "My favorites" page Hi everyone. I am not familiar with js and jQuery, but need to create function to add/remove blog post to "My favorites" page and update counter of saved posts. Is any ready solution - plugin or snippet - to it? There is my html snippet. http://www.example.com/add-post-to-my-favorites-page.htm"; id="post_0064">Favorites Heading Body copy. [...] [...] http://www.example.com/account/ favs.htm">My Favorites46 I think that it can be done with $.ajax, but have not idea how. Thanks in advice.
[jQuery] Re: submit inside submit
I have request boxes. they are called from index.cs.asp? Process=ViewRequests. Then I have forms inside these boxes. All with same ids #REQUESTFORM. when user clicks submit button (all have name=respond) in any of these forms I need that form sent to index.cs.asp?Process=RespondRequests and print server's response. To use closest, I divided the code into two pieces. However, I think I still cant grab clicked form 's data. I dont receive any errors but it grabs wrong form information and does not print back server's response. $("[name='respond']").live('click', function() { $.ajax({ type: "POST", data: $(this).closest('#REQUESTFORM').serialize(), url: "content/requests/index.cs.asp?Process=RespondRequests", success: function(output) { $('#REQUESTFORM').html(output); }, error: function(output) { $('#REQUESTFORM').html(output); } }); }); $(function Requests() { $.ajax({ type: 'GET', url: 'content/requests/index.cs.asp?Process=ViewRequests', success: function(data) { $("#requests").html(data); }, error: function (XMLHttpRequest, textStatus, errorThrown) { $("#requests").html('.'); } }); });
[jQuery] Re: submit inside submit
This here: $(function Requests() { // ... }); What are you trying to do? That's not valid Javascript syntax. On Aug 18, 4:47 pm, efet wrote: > Hi, > > I dont understand why the following code is not working. I dont > receive any errors, its just not working. > > $(document).ready(function() { > $(function Requests() { > $.ajax({ > type: 'GET', > url: 'content/requests/index.cs.asp?Process=ViewRequests', > success: function(data) { > var that = this; > $("#requests").html(data); > $("[name='respond']").click(function() { > alert(that) > $.ajax({ > type: "POST", > data: $(that).closest("form").serialize(), > url: > "content/requests/index.cs.asp?Process=RespondRequests", > success: function(output) { > $(that).closest("form").html(output) > }, > error: function(output) { > $(that).closest("form").html(output); > } > }); > }); > }, > error: function (XMLHttpRequest, textStatus, errorThrown) { > $("#requests").html('.'); > } > }); > }); > > });
[jQuery] submit inside submit
Hi, I dont understand why the following code is not working. I dont receive any errors, its just not working. $(document).ready(function() { $(function Requests() { $.ajax({ type: 'GET', url: 'content/requests/index.cs.asp?Process=ViewRequests', success: function(data) { var that = this; $("#requests").html(data); $("[name='respond']").click(function() { alert(that) $.ajax({ type: "POST", data: $(that).closest("form").serialize(), url: "content/requests/index.cs.asp?Process=RespondRequests", success: function(output) { $(that).closest("form").html(output) }, error: function(output) { $(that).closest("form").html(output); } }); }); }, error: function (XMLHttpRequest, textStatus, errorThrown) { $("#requests").html('.'); } }); }); });
[jQuery] Re: KFManager v1.0
I was able to get this working. I'm now integrating with codeigniter to see how it does there. On Aug 18, 4:06 pm, Web Specialist wrote: > Good job. Awesome! > > Cheers > Marco Antonio > > On Tue, Aug 18, 2009 at 1:20 PM, Ken Phan wrote: > > > KFManager (Ken's File Manager) is a plugin of jquery. It uses AJAX to > > manage image files in a web browser and it was developed to help > > programmer gently in the file manager. It is easy to use > > > demo >>http://trinhvietcuong.com/ken/index.html
[jQuery] Re: First Attempt
It looks like clicking the (submit) button is also submitting the form, which loads the same page again with the default text size. Add a "return false" to prevent the form from submitting. $('#small').click(function() { $("#textsize").addClass("smalltext"); return false; }); On Aug 18, 3:40 pm, AMP wrote: > Its pretty simple, I've included all the code here: > * > A.html > > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";> > http://www.w3.org/1999/xhtml";> > > > Untitled Document > > > script> >