.click() or .animate(); not working in Webkit or IE (works fine in Firefox)
This works fine in Firefox but not in the Webkit browsers or IE $(document).ready(function(){ $('#lastweek').hide(); $('#nextweek').click(function(){ var lvalue = parseInt($('#weekholder').css('left')); if(lvalue > '-818'){ $('#weekholder').animate({left: '-=273'}, 'slow'); $('#lastweek').show(); } else{ $('#nextweek').hide(); } }); $('#lastweek').click(function(){ var lvalue = parseInt($('#weekholder').css('left')); if(lvalue
After .load(), other .load()'s evaluate multiple times
Best title I could come up with. I have a dive with multiple links in it, when one of them gets clicked, jQuery will .load() an external page using data passed along from whichever link was clicked. In this new .load()ed page, there are other .load()'s (different classes and ids than the original ones). If this is the first time I .load()ed from the first set, and then click a .load() from the new data, the new .load() will only happen once. If I .load() another link from the original list and click
index() not returning index of object
This is driving me insane! I am trying to get the index of a li with a specific class. I know I'm selecting the right object because I can apply a CSS class to it (eg change border colour) but when I try to get the index it returns -1. But I know the object exists as I can alter it. :-s So, any ideas what I might be doing wrong? jQuery(document).ready(function() { var active = $("#tertiarynavigation .bordered").get(0); var num = $("#tertiarynavigation li").index(active); alert("Index: " + num); });
Unable to restrict focus to a textbox for input error
Hi, I am trying to restrict focus to a textbox if there is input error, but with no success. Here is my javascript: $(document).ready(function () { $("#txt_username").blur(function () { var username_length; username_length = $("#txt_username").val().length; $("#username_warning").empty(); if (username_length < 4) { $("#username_warning").append("Username is too short"); $("#txt_username").focus(); } }); }); and html: <form
jQuery not working in IE8
I developed an small jQuery application and it work perfectly on one machine(Win Xp,IE7,FF3.6), but same application is not working on other machine(Win 7,IE8, FF3.6). Also, I tried to create a new application on Win 7 one, but when I try to run, it gives me error "Object required" and it points to only functions written in jQuery. Thanks, Ketul
Append() only appending once, even on multiple calls...
append.php: <span>test</span> jQuery function: $(function(){ $("a.role_link").click( function(){ $.get('append.php', function(data) { $("#roleDiv").html(data).append(); $("#count").val( parseInt( $("#count").val() ) + 1); }); }); }) HTML: <input type="hidden" name="count" id="count" value="0" /> <div id="roleDiv"></div> <div><a href="#" class="role_link">Add</a></div>
How to stop a loop in setInterval(function()?
I've this script that make change a class every 3 seconds. How do I stop the loop, so it will stop on the second class? $(function() { var $target = $("#wrap"); var classes = ['hide', 'show']; var current = 0; setInterval(function() { $target.removeClass(classes[current]); current = (current+1)%classes.length; $target.addClass(classes[current]); }, 3000); // 1500 ms loop }); Thanks Mirko
How to reset all changes to defaults with jQuery?
Hi! I use jQuery for loading ajax content, changing css etc. I want to make button that does something similar to "Refresh" - changes back all css changes to defaults. Is there a function that could do this?
why does the browser window scrolls itself up after inserting ajax post back content into a page element?
Hi Experts, I am relatively inexperienced with jQuery and Ajax. I have a problem with ajax post back call that I do not understand. The problem is: Why does the browser window scrolls itself up after inserting the html content from server into a page element that is returned by the ajax post back call? - This naturally happens when the html-element into which the content is added is at the end part of a web-page which requires scrolling down to be seen on the screen. function Loadhtml( url )
Help with .animate()
What I'm trying to accomplish is scrolling left 183px when clicking and everything looks right but it doesn't seem to be working. Here is what I've got- $('ol.days li.previous a').click(function() { $('#calendarContainer').animate({ left:'-=183px' }, 1500) });
.animate() not working for me...
I'm trying to get a div#calendarContainer to scroll left -183px on click; everything looks right, but its not working... $('ol.days li.previous a').click(function() { $('#calendarContainer').animate({ left: '-=183px' }, 1500) });
Stopping back button from refreshing the page and undoing all the javascript user actions
The situation: I have a number of pages that organize book data by category and then by unit, chapter, section, etc... Since there is a ton of data I display the headings and hide the rest of the content for the category. When a user clicks the heading then the content for the heading is shown underneath it. This works great and the users don't have to scroll (at least not much in comparison to if everything on the page was visible) unless for some reason they expand tons of stuff. The problem: My
Javascript to Jquery
I'm in a bit of a rut. I need to figure out how to convert all this code into jquery. Since I don't know too much jquery. http://www.lastyearsloss.com/store/javascript/map.js I'm not sure which lines I can use or which ones change fully. The main problem is where I'm importing the data from xml. If anyone can point me in the right direction that would be awesome! thanks!
Trouble with jQuery getJSON
I am using the following URI like so to pass to jQuery's getJSON. var publicVidsUrl = 'http://api.publicvideos.org/v/0/clips?callback=?'; $.getJSON(publicVidsUrl, function(data){ alert(data.length); }); ...but it is failing. While the JSON returned passes as valid in JSON lint, I am not so sure. The escaped double quotes seem fine, but I wonder about the double quotes around each object in the parent array. Can anyone please help clarify where this error is coming from? Specifically I am getting
Table & Row Selection
Hoping this is a simple one. I need to make the backgrounds on certain rows a different color to help the info to read better. I used the following: <!-- Directory of Staff Row Backgrounds --> <script type="text/javascript"> $(document).ready(function() { $('tr:odd').addClass('odd'); }); </script> But instead of starting over with a new table it seems to just have counted them all so it looks off. I'm newer to jQuery but hoping someone can hlep me shed some light on how to fix.
Problem display with IE
Hi, I have a problem with Internet Explorer and a functiun jquery. I have a function in javascript : jQuery(".showhide").click(function () { jQuery(".showhide").toggle(); jQuery("#MenuContact").toggle("slow"); }); So when i click on my link who are in the html page the div #MenuContact appear, it's ok. But the link in my html code disappear. Only on Internet explorer. So i can't click on my link for hide the div. My html code : <a href="#" class="showhide">Contacts</a><a href="#" class="showhide"
Jquery selector for textarea and input fields?
Hi, I have a function targetted to input fields with class="replacetext" and type="text" $('input.replacetext[type=text]') How can I make this same function work also for textareas with class="replacetext"? I have tried: $('textarea ,input.replacetext[type=text]') $('textarea.replacetext ,input.replacetext[type=text]') these does not work... Heres my code: $(document).ready(function(){ $('input.replacetext[type=text]').live('focus',function(){ if (this.alt == '') {
Onclick Disable in Jquery
Hi all, I am new to Jquery.I have to disable the PostLink mentioned in the below code .oncick i want to disable (to avoid continuous clicking) and proceed to javascript.I don't know how to implement in existing code. var currentTotal = 0; var insertedSpan; var firstNoteAccepted = false; var postLink; var postLinkText; function noteAccepted(value) { if ((!firstNoteAccepted) && (value > 0)) { firstNoteAccepted = true; postLinkText.text("Post Transaction"); postLink.attr("href",
jquery dialog and php
Hi, I'm new to jquery. I want to ask you is it possible to use jquery dialog with php. Using this tutorial http://jqueryui.com/demos/dialog/#modal-confirmation I want to call a php script with will delete a row into Mysql database. Is it possible to do it? regards
ajax .html() image not working on chrom and safari
Hi guys, I got an ajax that creates an image tag whenever a drop down for car brand is clicked, it works well in firefox and internet explorer, but doesn't show on safari and chrome The ajax: $.ajax ({ type: "POST", url: "<?php echo base_url();?>index.php/welcome/brandlogo", data: "brandID=" + this.value, success: function(msg) { $("#brandlogo") .html(msg);
Overlaying div with png over slider
I have made a slider, not unlike other sliders, but I made my own. I have two versions, one vertical and one horizontal. Both of them let you slide through images with arrows back and forth / up and down. I have the same problem with both however. In IE it doesn't show the png that I use for the "arrows" on mouseover left or right on the picture. I thought it was the div order problem, but the div is visible on top, it just doesn't show the picture is what it seems like. See the web page to take
Please, PLEASE help with this Jquery question
I'm using this image slideshow on top of a page: http://www.htmldrive.net/items/demo/28/Featured-Content-Slider-Using-jQuery and this slideshow on the bottom http://www.htmldrive.net/items/demo/41/Slideshow-plugin-for-the-Tabs-with-jquery. I have noticed that when I put the text slideshow at the bottom, the image slideshow stops working, any idea why? Thanks
I can not append
My code has a button that when pressed it include a html element. But when I click the button the included information blink and disappears, what's wrong? $('#nwelem').click(function() { $('ul.addedRow').append('<li><div><h4>some text</h4></div></li>'); }); <ul class="addedRow"> <li> <div> <p>Added</p> </div> </li> </ul>
multiple div panel slideup/slidedown cookie problem
i currently have 2 panels with information that have a link that when it is clicked it adds the class collapse and shrinks div and when collapse is clicked it expands the div. $(".collapse").live("click", function () { var header = $(this).parent(".header").attr('id'); $(this).parent(".header").find('a').slice(0, 1).addClass("collapsed").removeClass("collapse"); $(this).parent(".header").next(".panel").slideToggle("slow"); $.cookie('customerinfo',
Creating variables/array from class selector
I'm new to js and jQuery and amazed by the ease jQuery presents in common javascript tasks and dom tasks. With that being said, I'm looking for some advice to point me in the right direction with a project I am working on. I have a row of images in a div. I have employed the jQuery toggle function to toggle on and off a class of 'active' on the images when they are clicked. I will now need to somehow read the images that are active, and then create a set of variables, or an array with unique ids
Accordian Menu with advanced options question...
I have a webpage that I have integrated a script for an accordian menu. I need to know if I can make the headers that currently open a specified page in an iframe while also opening the accordian submenu, to open the same specified page when you clcik again on the header to close the accordian menu. Currently the header closes the submenu only. Is this possible? I have provided as much detail as I could think of. I am by no means a programmer but I get around well in coding. I have my page linked
Class click
I have a form with 20 labels on it. I have assigned them to a common class (cpLabel) and added a handler for the click event. What I want to do is get the text of the specific label that was clicked. Can I do this? Or do I have to assign individual ID's and create handlers for all 20? TIA John
AJAX Server Down
When my server is down, I make an jquery AJAX call in Firefox 3.6.3. Firebug reports the request has failed, but no function is called as defined in the jquery AJAX options. In IE 8, the timeout is reached, and then the error handler (loadError) is called. I have the following options defined. How can I have jquery call my loadError function in Firefox as it does in IE? Thanks in advance for your help. var options = { success: loadSearch, // post-submit callback
Appending To onchange Event
I'm trying to use jQuery to append to the onchange event of each of the following input elements. The following code actually replaces the event. When the onchange event fires on any of the elements, I get one alert which just says "new". What I would like to see is 2 alerts, one that says "test?" where ? is the element that changed and another that says "new". Any help you could provide would be greatly appreciated. <input type="text" id="testInput1" onchange="alert('test1');" /> <br> <input type="text"
Preventing Psot till after validation
Hello, I have an extra button on my page that uses the Axax method to check if a username is taken(This works). But, I dont want it to submit unless there are no errors on the validate method. Not sure where to put them. $(document).ready(function() {$('.error').hide(); $("#CreateAccount").validate( { errorPlacement: function(error, element) { error.insertAfter("#chkAcct" ); }, rules: { Username: { required: true, minlength: 3 } }, messages: { Username:
ajaxError being triggered even with 200 ok status returned?
Hi there, I am loading a largeish chunk of json which is about 47kb in size according to firebug. I can see the html in firebug and 200 ok status but for some reason it is triggering ajaxError? Firebug says the file is taking just a few milliseconds to download so I think it is probably the parsing of the json that is slow and exceeding the timeout? I have tried setting timeout: 200000000 and using ajaxSettings but it is still doing the same? $.ajax({ url: '/admin/viewer/rates', data:
How to catch users input with html() ?
Hello ! When you try to select some HTML modified by the user like an input, it returns the original html. Example : <input type="text" value="" name="test" /> If the user write "something" in the textbox and then echo the html, the input value will still be null. (At least in firefox) Is there a way to catch these inputs as well ?
Empty textfield using jquery?
Hi, I have 2 questions: ---------------------------------------------------------------------------------------------------- QUESTION 1: I have a function that is supposed to empty the textfield when "onfocus" if the value is the defined "ValueToCheck" like this: function removetext(strElement,ValueToCheck) { if (document.getElementById(strElement).value == ValueToCheck) { document.getElementById(strElement).value = ""; } } I call it onfocus from an input field from another file(index.html)
Get the whole temp context after manipulation
Hi I am trying to use Jquery as an XML tool to transform xml data other than the DOM. var xml = '<node>*plenty of xml*</node>'; $(xml).find('#id').html('some text'); This works very well and i can change my xml data. Now i want back my whole xml that i just transform and this is where there is a problem ! $(xml).find('#id').html('some text').parent.parent.parent ... is not a good way I read something about the defaultContext but it seems risky / hazardous. Needed fonction would be $(xml).find('#id').html('some
jQuery img disappears when animating in IE6
Hi I tried to create a simple pagination-style presentation and when I start the animation my img tags disappear. As far as I can tell it's not an overflow problem. Please someone help.
.clone() with slideDown
Hi. I have this function which copies a table (that are inside a row), and inserts the new table copy inside the same row: function AddNewStop() { $("#SingleStop").clone().appendTo("#AllStops"); } Instead of just showing instantly, I would like the new table to slide down in a nice effect. But I cant get it to work. I´ve tried several things, like hiding the table first like this: $("#SingleStop").clone().appendTo("#AllStops").hide().slideDown(500); But that didnt work either. What am I doing
JQUERY HELP
Hello Everyone, I am new at JQUERY. But it seems to be fun to work using jquery But I've a problem in selecting a default value using jquery. I want that after successful submission of data into the database. All the values in the textboxes should be cleared( I did it using :- $("#id_email").attr("value",""); ) . Similarly, I want that the dropdownlist should display the default value "--SELECT--". What should
A function which prepopulates textfields with value of label
I have a form which looks like so: <form class="subscribe" id="form-5" method="post" accept-charset="UTF-8" action="/subscribe/"> <div> <div id="edit-name-1-wrapper" class="form-item"> <label for="edit-name-1">Name: <span title="This field is required." class="form-required">*</span></label> <input type="text" class="form-text required" value="" size="20" id="edit-name-1" name="name" maxlength="128"> </div> <div id="edit-mail-wrapper" class="form-item"> <label for="edit-mail">Email Address: <span
JQuery Form Validator Problem
hi, i have a code from php point of sale like this : $(document).ready(function() { $('#supplier_form').validate({ submitHandler:function(form) { $(form).ajaxSubmit({ success:function(response) { tb_remove(); post_person_form_submit(response); }, dataType:'json' }); }, errorLabelContainer: "#error_message_box",
Syntax error, unrecognized expression
I've been using jQuery 1.2 for a while, and I recnetly upgraded to 1.4.2. I have a piece of code: jQuery('input[@name^=prev_indivStatus_]') for which jQuery now throws the error: Syntax error, unrecognized expression: [@name^=prev_indivStatus_] I'm attempting to lookup the form field whose name begins with the text "prev_indivStatus_". Why has jQuery lost the functionality to make this match?
Next Page