Multiple forms all getting submitted
Hi, I have multiple forms on a page and want to connect to the submit event of each form, how ever when i click the submit button the submit is triggered for each form on the page instead of only for the form that the submi button was hit as i am intending. Can someone explain this behaviour ? is submit a global event instead of against each form ? Any suggestions on how to resolve this ? I have thought about using a click method on the submit button but realize i would be better of using .submit
I can't figure out how to select this element
Hi, I am trying to change an attribute of an element but can't figure out what the selector is to select it. the page code is like this <div class="slideshow" id="slideshow"><span class="image-wrapper current" style="opacity: 1;"><a title="" href="#2" rel="history" class="advance-link"> <img alt="" src="images/samples/1.jpg"></a></span></div> I want to add a top css attribute to the img tag. Please help me out I tried many things such as $('.advance-link:first') $('.advance-link:firstChild')
Need help with jquery as variable
Hi, I would like to use jquery as variable, first is this possible and if so what am I do wrong? Any help would be awesome. What I'm trying to do is if #someid has display set to none set var test to IfAnswer else set var test to ElseAnswer. var test = ($('#someid').css('display':'none')) ? IfAnswer : ElseAnswer; thanks Daniel
Problems using setTimeout and clearTimeout
Hey, i cant get my head around this, been trying different things for 2 hours, if anyone can shine any light on this problem ill love you forever. $('#girl').mouseout(function() { hidegirl = setTimeout(function() { $('#girllinks').fadeOut(); }, 1500) }); $('#girllinks').mouseenter(function(){ clearTimeout(hidegirl); }); basically #girl fades in #girllinks, then if the mouse moves out of #girl #girllinks should fade away after 1.5
Encapsulating jQuery Object
Recently I posted a little snippet of code that I was having an issue of setting element focus. One of the responses was that my jQuery Encapsulation code was incorrect. Instead of just making the change, I did some research and found "REFERENCING MAGIC - SHORTCUTS FOR JQUERY". http://docs.jquery.com/Using_jQuery_with_Other_Libraries On this page the jQuery Document outlines 4 different ways for encapulating jQuery: Referencing Magic - Shortcuts for jQuery If you don't like typing the full "jQuery"
fadeIn/FadeOut not working in IE
Please take a look at this website in Fireforx and Safari, then IE8. http://www.kmkmediagroup.com/RainierValley/TestSite5.html When you click from the main Navigation on the left, its a fairly smooth fadeIn/fadeOut transition between categories (pages) in Firefox and Safari. But in IE8 the transition is abrupt, almost like I am using 'hide' and 'show' instead of fadeIn/Out. Anyone know why it's doing this and/or how to fix it? Thanks for any help! (this is still a work in progress)
JQuery Focus, after blur
I have two form elements, the first one I'm testing for a specific content length (5). If there is not that much content in the box, I would like it to continue to have focus. However my code below will not set the focus back.. What am I missing? jQuery( function($){ $(document).ready( function(){ $("#Transit_Number").blur( function(e){ if ( $(this).val().length != 5 ){ e.stopPropagation(); e.preventDefault(); $("#Transit_Number").focus();
Grab text nodes from node only, not it's children's text
So I have the following xml: <ingredient name="rice"><us>1 cup</us><metric>250 mL</metric> of uncooked Korean rice</ingredient> I want grab only the "of uncooked Korean rice" part. I tried to use text() but it would grab the text from inside the "us" and "metric" element. Thanks for any help.
wait till page is fully rendered before collecting information.
Hi I am trying reload a div on a page with content from another page using ajax. I am able to do this but the problem is that I need to wait for the page (that I am sending an ajax request to) to finish inputing all the relevant html before it is shown on the page calling the ajax otherwise the re-load of the div will not be up-to-date. Any ideas welcome (Here is my code) $('.addbskt').click(function(){ $.ajax({ type: 'GET', url: this.href, success: $(".additionalcorethree").load("bsk
Unbinding handlers to events fired on regular objects
bind() and trigger() on regular, non-DOM element objects seem to work even though it was not mentioned in the docs. But how can the handlers be unregistered? one() and unbind() both fail while trying to call removeEventListener().
Opacity - Can do if animating, but how do we do it outside of an animation?
Hello all. I have a window that I animate its opacity to 'turn on' on click. In order for it to NOT be 'on' when I start I have to animate it down to .0 on load. If I set the visibility to hidden, or display to none - it wont animate up. How do I set the opacity without using something like this $('#iframe_holder_border').animate({ opacity: .0, }, 500, function() { //do something after animation }); If I understand correctly this is the only cross browser opacity that works? I saw filter
Random intervaled timer
Hi, I am trying to build a timer that counts down from a randomlly set number and decrease at random timed intervals! I have managed to get the timer to set and start at a random number! I am having trouble getting it to set the random interval time between changes! Anyone able to help? As an added bonus I would also like to be able to remember the number it was on if the page is refreshed etc! Thanks Code is currently: <script type="text/javascript"> $(document).ready(function(){
Weird JSON object (scope?) problem in $.ajax
This is a weird one. I often use JSON object. I declare them as usual (var someobject = {};) and then construct further down, like someobject[somevar]... = somevalue; Needless to say, that works everywhere.. accept for inside of a $.get or a $.ajax success function. I keep getting a 'object is undefined' error, even when I declare the object inside of the function (so not relying on scope outside of it) I have no idea what is going on there?!?? Anyone got any idea?
Set contentType for http request is ignored by explorer
I’m writing some code to get and update some content via a rest webservice. Here is the example of the code for http put request. $.ajax({ type: "PUT", processData: false, url: resourceUrl, data: xmlDoc, dataType: "xml", contentType: "application/xml", success: function() { .... Internet explorer request: PUT /xxx/yyy/1 HTTP/1.1 Content-Type: text/xml; charset=UTF-8 Accept-Language: da Accept: application/xml, text/xml, */* Accept-Encoding: gzip, deflate
Toggle checkboxes and uneditable checkboxes
I have a series of checkboxes and a button. When I click the button, I'd like all of the checkboxes to either all turn on, or all turn off (a toggle). In regular javascript I can do this: var checkflag = "false"; function check(field) { if (checkflag == "false") { for (i = 0; i < field.length; i++) { field[i].checked = true; } checkflag = "true"; return "Uncheck All"; } else { for (i = 0; i < field.length; i++) { field[i].checked = false; } checkflag =
How to get the values on change function..can anybody help me out?
i have this code the class name Efiveper having the edtitble values.. I am trying to get all the values on change any editable this values I need to store in array so that I can pass that array of values to the controler to update that perticular user.. my questions is how to get the more than one updated fieldset values on change function? $("fieldset").each(function() { $(".Efiveper").change(function() { ischeck = true; var array = $(this).closest("fieldset").find("input,
{jQuery+PHP+MySQL} Add/Remove dynamic button
Hi everyone! I'm new to jQuery and i need a little help about something i want to do with the power of jQuery. I have a list of songs displayed with a button "Add to wishlist" for each song. When it is clicked, i want it to change CSS style so the image will be "Remove from wishlist". When we add or remove a song in our wishlist, it will add or remove an entry in the MySQL table WISHLIST (structure: id, id_member, id_song). And at the top of the page i have a counter (Number of wishs : 0) and i want
$(xml).find problem
$.ajax( {type:"GET", url: "newBlogPost.php", dataType: "XML", success: function(xml) { var v=$(xml).find('daysSince').text(); var t=$(xml).find('title').text(); if(v<14) { var i='<img src="images/newpost2.png" /><br><span class="t1">' + t + '</span>'; $('#newpost').html(i); } }
Toggle & animate div location, text displayed & graphic rotate
Hi All, Here's what I'm trying to do: When someone clicks on plain text with div of "hdrlink", then div of "slideshow" will close up using toggle. At the same time also need div of "headerNav" to move up 300px. When the user clicks "hdrlink" again, then "slideshow" reappears and "headerNav" move back down 300px (starting position) Here's the script: <script type="text/javascript"> $j('#hdrlink').click(function(){ $j('#slideshow').toggle(800), $j('#hdrlink').toggle( function(){
Slowdown in JavaScript game on a laptop
I wrote a game in JavaScript/jQuery that uses a timer to update the character periodically. It works fine in a browser but when I run it in Ogre (via the Awesomium plug-in) there is a significant slow-down, although it still runs acceptably fast on my workstation. However, when run on a laptop with lower specs, it runs very slowly, it is not even playable. Here is the relevant code: This is the main game file that starts the timer and calls the Update function of the main character: const TIMER_INTERVAL
pattern matching against a list
<ul id="menu-main-navigation" class="menu"> <li class="menu-item"><a href="">listitem1</a></li> <li class="menu-item"><a href="">thislink</a></li> </ul> I have a list that I want to pattern match against the string "thislink" (2nd list item) and add a class to it's parent "current" so that the resulting code would be: <ul id="menu-main-navigation" class="menu"> <li class="menu-item"><a href="">listitem1</a></li> <li class="menu-item current"><a href="">thislink</a></li> </ul> How do I do this?
Select a link by it's URL and totally rewrite that link
Hi, I'm new at this so I don't even know if this is possible, but here's exactly what I'd like to do: 1. scan all links on the page (which look like "<a href="<Link URL>"><Link Title></a>") 2. if any of the <Link URL>s begin with "http://youtube.com/watch/", "http://flickr.com/", or "http://imgur.com/" then, 3. rewrite the entire link like this: <div id = "my-target"> <a href="#" onclick="return hs.htmlExpand(this, { contentId: '<Link URL>', width: 495, align: 'center', allowWidthReduction: true}
Understanding Order Of Execution and Events Within Jquery
Is there documentation that simply explains events such as: $(function(){} and $(window).load(function(){} and placing an action direct in the page <script> $('#div_id').click(function()} //do something }); </script> and how/when they work with regards to where they are placed within the document? I eventually figure out the answers as I program, but often find myself stuck until correctly placing the code. I thought this may be a good resource for others as well. (If you do not have time to
Need some help with some specific things in building a menu
I have a mockup of a new menu I am building here. All of the css and javascript/jQuery code is on web page itself. I just need to get two things changed and I'm done: 1) The three middle items that have sub-menus, "services", "pricing", and "about" won't actually link to pages themselves. The CSS (I built this menu based on a web site's tutorial) is looking for the <a> tag to set the background color during a mouse-over. Since those list items don't actually link to a page, I want to remove the <a>
Problem getting field value from Modal Windo.
Eh everyone, I've been having no luck trying to get values from fields inside a window that is appended to the document (My main Page Container class). When I use the .val function on my fields, I get empty results when someone click on "Submit". $('#login').click(function(){ $('.container').append(" <div class='window'> <div class='closeWindow'> </div> <h1>Login:</h1><br/> <b>Email:</b><br/> <input type='text' id='loginEmail' name='loginEmail' value='' size='30' class='bigField' /><br/><br/>
How to get ID of parent?
Hello all. I am trying to get the ID of a parent. For example: <div id="parent_holder1"> <div class="child_div">child div instance one</div> <br /> <div class="child_div">child div instance two</div> </div><!-- PARENT HOLDER 1 --> <br /><br /> <div id="parent_holder2"> <div class="child_div">child div instance three</div> <br /> <div class="child_div">child div instance four</div> </div><!-- PARENT HOLDER 1 --> When I click any of the children with a class of 'child_dev',
Coda Slider help
I followed the tutorial @ http://jqueryfordesigners.com/coda-slider-effect/ and implemented it nicely on my web site redesign. However, when I view the site in IE the sliders do not work. Everything works fine on Mac (all browsers) and PC Firefox only. site is here: http://hvhn.com/hvwd/redesign and http://hvhn.com/hvwd/redesign/projects.htm I am not sure what I did wrong. Is it the CSS? What can I do to make this work in IE 6+ - Thanks
Highlighting current page in a nav menu
In the menu in this page I have four different methods (you can see them in the <script> tag on the pages) of indicating the current page in a menu. I downloaded these from various web pages after Googling "jQuery highlight current page". None of the methods works. Is there something wrong with my selectors? Can anyone see why none of them are working? Thanks for anyone's help!
Hiding/showing multiple DIVs
Hello all, I'm new to jQuery, and I'm having issues with showing my DIVs correctly. The problem with the script at the moment, is that it currently opens up every single .display div, whereas I only want it to open up the one which corresponds to the .input a.edit which I've clicked. The script hides them individually, displays the hide button and makes the show button display correctly like I wish, but it's displaying all the the .display div's at the same time which isn't what I want. For reference
How to open links of ajax page in same ajax part?
hey guys, i was using $.ajax method to get my ajax page on my main page, which is working great. But now if i have links in that ajax page then i can't open them in that same div, the links are opening in new window, but i want to open in same part, i tried google it and then found, i have to use iframe instead of div. So, can any one gave me any idea how to do with only use jquery and div. Thanks in advance....
string replace
Please help me on this string replace, from "element[-1].unit" to "element[0].unit", I have tried this str = str.replace("element\\[-1\\]/gi", "element[0]"); All doesn't work. Thanks.
$.post("/my_url") is ignoring "/my_url" and posting to the page url in IE7
Hi, I have the following code working in Chrome, IE8 and FF: $.post("/my_url", { param: "1" }, function(data) { // }, "json") In IE7 I can see the posts on the server but they are to the wrong url ("/" in this case). Has anyone seen this before? Any ideas what's going wrong? Thanks, Natalie
missing ; before statement
hi at all, I have a issue with the application of one of my jQuery functions, exactly I have programmed this code: jQuery.noConflict(); jQuery(document).ready(function(){ jQuery("#repository").click(function(event){ //just because prototype is running if(jQuery("#repository").val()=="local") { jQuery("#localbrowse").css("display", "block")); }else{ jQuery("#localbrowse").css("display", "none")); } if (jQuery("#repository").val()=="remoto")
jQuery Blinking on Initial Load
(link removed by poster) Click on "Personal Pathways". Any idea why the jquery would start blinking on the first click, but load fine after? I swear it wasn't doing that at first, something changed, I went back through everything line by line removing and checking added elements but I'm stuck. Any help is appreciated. Carl
JQuery load() to load html/javascript - how can I debug this js?
I'm using jquery's load() function to retrieve an HTML snippet and I'm injecting it into the DOM. The HTML references a javascript file and that too is successfully loaded as its contents executes as expected. However, I can't debug this javascript because Firebug doesn't know it exists. Is there a cleaner way to do all this and still have the ability to debug the Javascript in Firebug? Thanks
Change text color in Array output
I want to change the color of the text in my array output according to certain conditions. The output looks like this: dfjklasdjkfklasjdfjkljasdfjljsd EVENT asdfkjfklasdjflaskdjfklasdfasidvj ROOT sdfjaskdlfklcmklfsdf LIVE_EVENT sdfjklasdjfklasdjfasdfk TEAM And I would like it to look like this dfjklasdjkfklasjdfjkljasdfjljsd EVENT asdfkjfklasdjflaskdjfklasdfasidvj ROOT sdfjaskdlfklcmklfsdf LIVE_EVENT sdfjklasdjfklasdjfasdfk TEAM Any Ideas?
How can Upload a file..
Dear all, I need to upload file in server.... value of textbox is saved but do not copy file to the target location. i try to like this..... ...............index.php.......... <form id="submit" name ="submit" enctype="multipart/form-data" target="upload_target" onsubmit="startUpload();" > <fieldset> <legend>Enter Information</legend> <label for="fname">Client First Name:</label> <input id="fname" class="text" name="fname" size="20" type="text">
offset() and webkit?
I have a problem with webkit-browsers. There is a canvas on my page and every time a user clicks on it (and while holding the mouse button down) a new <img> is appended to the body. Now the user should be able (still while holding the mouse button down) to drag this newly created image around. As it did not work with .draggable(), I did it with .mousemove() and .mouseout(): $(this.canvas) .mousedown( $.proxy( function(event) { <...>
Jquery calendar to show events on hover
Hi all I'm looking for a plugin or some help. Looking to create a calendar which can be paged back and forth through months and years. Additionally I would like to add events to the calendar so when a day has an event it is coloured differently and when user hovers over the event details are shown in a tooltip. Are there any plugins available to achieve this - any help appreciated! Thanks in advance
Can I have 2 sliders on the same page
Hi quick question, I'm looking to implement 2 different sliders on a page. the test page is http://www.rockyformayor.com/index2.php Now the main picture besides the passion leadership is jquery and does not move on this page however on every other page where that is the only slider it works. Now on this index2.php page you can see i put a slider in for a scrolling banner underneath the main banner and it works fine. Is there a way that I can have the 2 work hand in hand Thanks
Next Page