Selector with escaped character doesn't work when used with a context
I am having trouble writing a selector to filter selects by name when using a context and the name has escaped "[" and "]" characters. This is easily reproduced with the following code (uses console.log from FireBug): <html> <head> <script src="jquery-1.4.2.min.js" type="text/javascript"></script> <script> $(function() { var ctx = $("#mydiv"); // outputs "1: test[0]" $("select[name^=test]", ctx).each(function() { console.log("1: " + $(this).attr("name")) }); // no output
How to Cause The Load Method To Fail
Hey, I'm using jQuery with ASP.Net MVC (2.0). I'm using jQuery's load method to dynamically submit data, But I want to be able to cancel the request from the server and pass some error code. I saw the load method has a success callback, but it is fired after the data is loaded. Also, the success callback has a textstatus parameter, but I couldnt force it to be anything but "success". How can I cancel a load request from the server? Thanks ahead, --sternr
jQuery Selector: Find & "Perform"
Dear community, i want to use jQuery to perform 2 action within my articles: - create links (for a glossary), attributes needed: href, class, title, target, link text - highlight terms (for a search function) first of all, for the highlight-function, i tried: $("#content_article:contains('Test')").css("text-decoration", "underline");but then, jQuery underlines ALL content. I just need e.g. "Test" to be underlined (or yellow-backgrounded). for the second, glossary-function i'm using "tinyTips" for
changing page's background color
Hi all I have a small script that changes the background color of my page from white to grey when the user clicks a button. at the moment it works fine accept for when the user tries to navigate to another page (on my website) after changing the background color. if a user changes the background color to grey and than tries to view another page, the background color becomes white again. is there any way to make the change only controlled by the button? my head code looks like this (at least the relevant
Equal Height
Hallo, I want after I have a long text by Ajax request has loaded, assign the div container, a new height, but unfortunately it does not work. After loading can I find the amount of 3 containers by outsetHeight and then as the individual containers to the greatest height. According to Firebug, all have the same height in the style available, but these are not just angezeigt.Zum determine the amount after loading, I use the document.ready event could that be the reason or what can it be? Thanks
Cannot submit a form with jquery validation
Hello, I am trying to use jquery's ajax framework to check if the data that is entered is valid or not. The form works properly except i cannot get the page to go to action="something.php" file in the form part. This is what I currently have for my ajax: var passback = false; $(document).ready(function() { $("#add").submit(function(){ $.post("ajax/validate-company.php",{ company: $("#company_name").val(), address: $("#address").val(), address2:
SOLVED : jQuery IE Hover Problem Help?
SOLVED: I simply changed the tags to be more specific, i.e. : $(function() { $('a').hover(function(){ $(this).children('.front').stop().animate({"opacity": '0'}, 400); }, function() { $(this).children('.front').stop().animate({"opacity": '1'}, 500); }); }); as opposed to: $(function() { $('.nav').hover(function(){ $(this).children('.front').stop().animate({"opacity": '0'}, 400); }, function() { $(this).children('.front').stop().animate({"opacity":
JQuery: why won't clicking on a tab display text?
Hello, I have a question regarding Jquery. I have a "sell" tab on my page that when clicked, should display a text input box and a button. However, all I get is an error message in IE telling me that "Object doesn't support this poperty or method." I want the "sell" tab to display the text input when clicked, otherwise be invisible, can anyone help me with that? here is my code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
jQuery Cycle Plugin in blogspot?
Hi, I hope somebody can help me. I want to install jQuery Cycle Plugin in to a blogspot platform (google blogger) I am not an script or code expert but normally find out of things with a lot of work. But now working about a problem becouse I got a script conflict between mootools and jQuery. The "no conflict" comand dos not work so now in the end I desided to shange to the nice jQuery Cycle Plugin who meet my needs. If somebody can explain how to install it to blogspot I would be super happy. And
jQuery conflicts
I am integrating a lightbox gallery into my site and am having an issue with an image slider that is also utilizing jQuery. I know about the jQuery.noConflict() function and how it overrides the $ variable. <script type="text/javascript" src="other_lib.js"></script> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript"> $.noConflict(); jQuery(document).ready(function($) { // Code that uses jQuery's $ can follow here. }); // Code that uses other library's $ can follow
offset(index, coord)
I'm trying to figure out how does work the new offset(index, coord) method. There isn't an exemple for this method in the jQuery documentation. So, I set up a very simple test case in order to inspect the function parameters index and coord. It is hosted at: http://jsbin.com/opufi/ The first alert works as expect and then the script stops returning the following error: b is undefined (var b is from the jQuery library). Is this a bug, or am I missing something?
How to use the -original- value of a variable in document ready function.
Hello, I've got a number of divs with the prefix menu and the suffix ## where ## is say 1-10. My code is below. It assigns the click function fine to each, but assigns them all the function based on the last value of the for loop. (It calls the current value, while I want the value from when the code was originally executed to set up the click function). Scratching my head on how to accomplish this. $(function(){ for (i = 1; i <=10; i++){ $('#menu'+i).click(function(event){ nav(i,event); //
How to send a input file from a HTML Form to a PHP file using the jquery load?
Hi I wanna send a file thru the JQuery.load, I want it to work exactly like the regular post without the JQuery. So I can check the $_FILES['file']['error'] in PHP and all its features like I do without using JQuery. Is that possible in the load method, how? if not what is the other ways to achieve this? Thank you. $("#load").load('gerenciar_itens.php',{/* This is where I wanna pass the file. */}, function(data){ alert(data); });
Jquery & Css Visibility
i have a <ul> inside it i have 6 <li> tags 2 of them set to visibility:hidden and positioned absolutely to be setting over 2 <li> tags , i want when i hover on the <ul> those hidden <li> set to visibility:visible and fade in and the 2 <li> that will appear under them to set to visibility:hidden (cause i want to maintain the same space that`s why i didn`t use display:none ) and fade out , so how can i achieve this using JQuery ? <ul> <li></li> <li></li> <li></li> <!-- i want them to
Only select ONE div?
Hi, this is probably a really easy problem, but I can not seem to find it, have been trying for 3 hours now... I have hidden 3 divs (these are created with a loop in PHP), and I want to show one at a time when the user clicks a button. How does one do a simple thing like that? I've tried with .each(), .next(), :first, ... If I select the divs with $(".extra") I have selected all 3 of them, and when I click the button $(".extra").show(); it shows all 3 divs, instead of 1 at the time... Driving me
Opacity animation on images stuttering
Hello, if I change the dimensions of an image via javascript and then try to make a opacity-animation on it $('#image').animate({ opacity: 'toggle' }, 1000, function() { }); the animation is not smooth any more, it is stuttering. The problem is definitly the changed dimension attributes, without setting them or setting them to the real size of the image, everything is ok. Problem occurs in Ubuntu/FF3.5.8 and Mac/Safari, Windows/IE7+8 + Windows/Firefox seem to be ok. Anyone had this problem before?
Documentation
Why do the API docs keep changing format? Can we keep them in the old more organized format? Having a giant list of methods makes it difficult to find information.
Clone new raw in table, rename attribute problem
I use clonetry to add new raw in table and rename the input field id, name, the id is changed, but the name doesn't updated and select filed not work for new raw. Thanks for any suggestions. Here is the sample: <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script> <script type="text/javascript"> $(document).ready(function() { $("#item_no1").click(function() { var row = $('#mytable tbody>tr:last').clone(true).insertAfter('#mytable
calling a JQuery function
I want to write a jQuery function that I can call using a line like the following: $("#database_user").alpha_numeric; I have written the function which is in the same scope as the line above, but the function is not being called & there is no Java script error. function alpha_numeric() { alert("Goodness me, I have been called"); }
evalJSON losing special characters
Hi, (Hope this is the right place for this - it's related to jquery.json-2.2.min.js) I have a JSON source (a plain text file) that has some special chars in it (ß, ê etc) and they look correct in the text file. However when I retrieve the file and use $.evalJSON against it the resultant array has things like � instead. I'm sure I must be missing something obvious, so for that I apologise in advance, but any help in getting the characters to appear correctly would be greatly appreciated. (I'm using
Display French text using jquery.
I have a question on JQuery multi-language support. We have to display some French text on the browser(IE 6). The data is read by a java server app from a file and populated in a JSON object and sent to the client (html, jsp, jquery). When the client receives the data on the callback function to the post call then the data comes corrupted...means the special characters are replaced by ? marks. Sample code.. //client call $.post("ServiceGateway", {'key':id, 'id' : id, 'pageId' : pageID}, attentionResponse,
Read cookie from json cross domain ajax response
Hey everyone I have a question: I'm calling an application with a username, and the application returns a cookie in the headers if the username is correct. I'm doing a cross-domain JSONP ajax query. Is is possible to read the content of the cookie? This is my code: $.ajax({ url: "myurl", dataType: 'json', success: function(response) { // read cookie here... } });
Grabbing current value of form input text
This should be fairly straightforward but I'm having some unexpected trouble. I have a form with an input: <input type="text" id="mysearchfield" value="search me">...the value attribute 'search me' is what is displayed on default page load. If I focus on the text field and type into it, "Hello World!" How can I see that new value? I've tried the obvious: $('#mysearchfield').val();This just simply returns the ORIGINAL value of "search me" though. How can I pick up the new value on the fly? It must
Nested Sortable that prevents moving outside the hierarchy?
Hello everyone, I have just stumbled into the world of jQuery and so far it seems amazing. I cam across it looking for a way to drag and drop a sortable list. The thing is that I have a nested list but I do not want the items to move out of their heirarchy which seems to be the case with the plug-ins I've come across. Can anyone help me? Can I use the built-in sortable library or do I need a plug-in (and if so, what should I use?) Example: 1111111111 AAA BBB CCC 2222222222
live does not trigger on first loaded sub element
Hello all, I am using a live, load, and toggle combo to load/hide/show nested tables (think folder tree). The page is initialized to show the top level (level 0) element (a span with class 'click2 loadL1') which when clicked will: + remove the 'click2loadL1' class to avoid double loading + replace the contents of the span with the current content plus a table with one span (with a class 'click2loadL2') in a single TD per each TR + finally bind a toggle to hide/show the loaded table The code works
using jquery to display google calendar on a webpage - simple
I know there is a google calendar plugin, but I simply want to read the google caledar xml and parse through the nodes to display event info on a page. I read this little tutorial and seems fine but how do I get it to work with the google cal feed? Anybody do this??? http://think2loud.com/reading-xml-with-jquery/ One of course would change the url: but how do I see the xml nodes from the feed?
Sharing a single jquery instance between frames
Hi Everyone, We have a very busy site that uses jQuery and frames extensively. The problem we have is that the service we offer runs on a secure server which means nothing can be cached, so every page loaded has to download jQuery again, meaning extra bandwidth for us and slower loading for our users. What we would like to be able to do is load jQuery (and potentially plugins like UI and others) once in one of the frames that doesn't change and then utilise it from other frames as though it had been
Attach ajax events to only one ajax request
Is there a way to attach ajax events to only certain requests. Every time I attach ajaxStart, ajaxComplete, beforeSend, etc. to any ajax request it attaches the event to all ajax requests. I want to specify only some. I have a site that is pretty much built and runs and different ajax requests. Only a few of them take long enough to need to display a progress bar. I don't see any way in the documentation that will allow to specify events to happen on only certain requests. Does any one have any ideas
Not all code is working- why not?
Anyone see anything wrong with this code? It prevents normal link click, posts to approve.php, and adds the css border. But it does not replace the .row's or #msg's html. I'm pretty certain my objects are selected correctly. Any ideas? $(document).ready(function() { $("input").click(function(e){ // stop normal link click e.preventDefault(); // send request $.post("approve.php", { submit: $(this).val(), hash: $(this).attr('id')}, function(xml) { // format and
Need to create Bing like pager
Hi Guys, I've a requirement of creating Bing like pager, I dont find any starters related to same functionality. Can anybody help. Thanks for any help!
add new raw in table and rename the input field name
I try to add new raw in table and rename the input field name in div, the id updated, but name doesn't updated and select filed not work for new raw. Thanks for any suggestions. Here is the sample: <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script> <script type="text/javascript"> $(document).ready(function() { $("#item_no1").click(function() { var row = $('#mytable tbody>tr:last').clone(true).insertAfter('#mytable tbody>tr:last');
FadeIn, Show, Animate: Font problem
Hey there, i´ve got a big problem with fading in, animating or showing elements, which include text. While fading in these elements, the font is some kind of green and creapy. When the element is displayed completely at the end, then the font is normal. This problem reveals on firefox (3.6). On ie8 the font is only a bit creapy, but i´m fine with that. Opera is fine with animiating font. Safari is fine with that too, but the header element, which is to show, goes out of it´s frame. Take a look on
next to last selector
Hi, I need to implement a next to last selector for our project. I came up with the following code, jQuery.expr[':'].next_to_last = function(obj, index, m){ var $this = jQuery(obj); return $this.find(m[3]).last().prev(); }; Is there any problem with this implementation? Thanks in advance, John
Replacing DIV content with other DIV content from same page.
I have content in hidden (invisible) DIV elements on a page that I want to load into another DIV element on same page. I need to replace content currently in a DIV with that coming from another DIV. DIV ontent could be a P element or a P and IMG element. Any help is appreciated.
.length Always Returns True
I'm brand new to jquery, and am trying to set up a dynamic navigation dropdown which is populated with XML by our system (which I can't change.) For some reason, IE6 is showing space where the unused <li></li> tags are. I am trying to create a jquery code which will detect whether or not a link is present in the <li> so I can turn the display off or on dynamically. The relevant jquery code is here: $('li.awardLevels ul li').each(function(){ if ($('li.awardLevels ul li a').length)
Problem with jQuery's load
Hello all, I have the following selectboxes: <select name="select1" size="20" id="location" style="width:200px;"> <option value="1">Location 1</option> <option value="2">Location 2</option> </select> <div id="products"> <select name="select2" size="20" id="product" style="width:200px;"> <option value="1">Product 1</option> <option value="2">Product 2</option> </select> </div> If I select one of the first selectbox (for example Location 1), the second selectbox changes, that differs
Need Help Reordering data in database
Hey Guyz, I'm working on a new script of mine and i need an Ajax reordering script Here's a picture of my project panel and here's a simple code to reorder a topic switch($_GET['topic']){ case"down": $order=intval($_GET['order']); $id=intval($_GET['id']); $orderup=$order-1; $q=$DB->query("select * from `topics` where `order`='$orderup'"); $down=$DB->fetch($q); $num_row=$down['id']; $query_up1=$DB->query("update `topics` SET `order`='$order' where `id`='$num_row' "); $query_up2=$DB->query("update
Quicksearch - run script on load?
Hello, I am trying to run the quicksearch script when the page loads. I have tried changing the bind to "load" and "ready". Neither of those two worked. I also tried changing it to "focus" and putting the focus onto the input field, but it only works in IE. The reason I want to do this is because I have a "view" button that brings the user to a new page. When they come back I want the results to still be there.
Problem with table row show/hide on Firefox 3.6
Hello We have a table with some lines are hidden. The user has the option to show them, trough a link. It was working until the last Firefox upgrade. We are using the show method to display the hidden rows. On the Firefox 3.6, after call the show method as $(".cls_receita").show() , the css attribute "display" is setted as "block". In all of other browsers, this property is setted as "table-row". When the property is setted as "block" all line (<tr>) is displayed on a unique column. That can be seen
How to copy a text with the html layout with Firefox and IE7?
Hello, So what I want to do is to be able to copy a content of a div with his complete layout. Right now I'm able to copy the text and the layout in firefox but not with internet explorer. The function copyToClipboard is working correctly I think the problème should be with the attributes I'm using to select what I want to copy: .clone().text() Does someone have an idea? Here is my actual code (without the copy to clipboard script, I can add it if you think it could help but I don't think so). <div
Next Page