Fatal in CLASS function with XHTML DocumentFragment: "elem.getAttribute is not a function"
(This is ticket 6162 which I spammed here after a question on the IRC channel.) Since jQuery 1.4, my XHTML web-app (too vague, I know) throws a fatal error in the |CLASS| function. Apparently, the |elem| that is being used is not an element but a |DocumentFragment|. When I switch the |Content-Type| to |text/html|, the problem is gone. I have hackily patched the |CLASS| function in jquery-1.4.2.js on line 3269 to check for a |firstChild| as follows: var className = elem.className; if (!className)
Treeview
Hi: I have implemented the following solution in order to use treeview jquery, but when the application access the method treeview(), it triggers and exception: object doesn't support this property or method. Looks like its not finding the method: treeview(). Here is my implementation, does anybody have any suggestion? this is my aspx: <%@ Page Title="" Language="C#" MasterPageFile="~/Views/Base/BasePage.Master" Inherits="System.Web.Mvc.ViewPage" %> <asp:Content ID="Content1" ContentPlaceHolderID="TitleContent"
event click, after load page
is there a way to add event click on link created by dom after load page ? Thanks.
Using JQuery server side with DOM?
Is it possible to emulate a browser's javascript/dom parsing behaviour somehow from an embedded javascript interpreter? I'm trying to do more powerful mail merges, and currently we transform poorly-structured HTML files using a C# DOM parser (http://www.codeplex.com/htmlagilitypack), but I can see substantial benefits of using JQuery to do the same thing. In simple terms, I want to somehow take plain HTML+JQuery and pass it through an interpreter to allow JQuery to manipulate the DOM. The end result
jQuery show hide multiple 'Other' input fields
Hi, Am having some jQuery troubles whereby i have some jQuery that toggles an 'Other' HTML input field and associated label when a user selects the value Other from a HTML select drop down. I have this working for one field but the application i am building has increased in scope whereby there may be multiple instances of members on one page so the Other option will be there multiple times. At the moment if a user selects Other from one drop down all Other input fields show. How do i make this exclusive
Animated GIF freezing on onchange, but working on onclick
I'm working with a list that has category tabs and dropdowns for navigation and filtering. It's a bit slow at times so I've added code to show an animated gif (spinner) when someone clicks a tab or selects something in a dropdown. $(document).ready(function(){ var image1 = $('<img id="spinner"/>').attr('src', 'http://192.168.2.64/images/loadera32.gif'); $('#jumpMenuYear').change(function() { $('#content').prepend(image1); }); $('#jumpMenuTheme').change(function() {
Why autogrow does not work after autopostback?
This is the code I use for autogrow. $(document).ready(function(){ $('.expanding').autogrow(); }); <asp:TextBox ID="txtNotes" runat="server" CssClass="expanding" Text='<%# Bind("notes") %>' TextMode="MultiLine" Width="96%" /> .expanding { line-height: 20px; width: 400px; }The problem is after RadioButtonList control autopostback happened, the autogrow no longer works. Any suggestion?
jQuery effects don't work on elements added by AJAX
Hi there, I am having problems with slideUp/slideDown effects on elements that I add to page with a AJAX callback. slideUp/Down works on elements that are present on the page load, but doesn't work on all elements added later with AJAX. <div id="lib-items"> <div class="item" id="item1">item 1</div> <div class="item" id="item2">item 2</div> <div class="item" id="item3">item 3</div> <div class="item" id="item4">item 4</div> ... </div> These items can be added with ajax... Then I
Object loses event binding in Internet Explorer
Hello, I am working on a script to allow the user to click on an image to turn table header locking on and off. Everything appears to work fine, with the exception of one quirk that is occurring when I run the test page in Internet Explorer (7, in this case). If you click on the icon once to turn on header locking, it works. If you then click the icon again, it turns off header locking, as it is supposed to. But after that, you can no longer click on the icon. It is as if it loses the event binding.
How to give default format in all datepicker control?
In my application having so many datepicker contols.where should i give this properties commonly. how should i pass dynamically in my textbox ID (or) which .js file i will set this properties commonly. <script type="text/javascript"> $(function() { $("input[id$=txtDate]").datepicker({ changeMonth: true, changeYear: true, dateFormat: 'dd/mm/yy' }); }); </script> Thanks in advance.
Mouseover or Mouseenter ?
Hi i'm pretty new to jquery and javascript in general so i have a short question you might be able to help me with: I have a div containing an image (.cover) and another div with an alpha-transparent overlay image (.cover_hover) in the exact position as .cover but set to display:none. when i roll over the .cover div i'd like to have the .cover_hover div shown, and when i roll out i want to have it hide again. how am i gonna do this the right way? This was my approach: $(".cover").mouseenter(function(){
Jquery not working in IE7 in callback function
Hello guys, I've been trying to input some code after a callback function. I've been doing several tests and I realise that jquery works if the $('#div).hide() is in a document.ready but since I want things to happen in the callback I can't put them there. Other test i've done is to get the src of an img in a div, that is returned correctly, tried to alert the with of the same div, I got 0 even though is set to 200. The script gives no error and gets to the end, but any html, append, hide jquery
x.each() giving strange results
I have the following functions: data = getDataFromCell($self); updateParents(data); function getDataFromCell(cell) { var data = []; classes = cell.attr('class').split(' '); $.each(classes, function(intIndex, className) { if (className.indexOf('pg') == 0) { data['parent'] = className.substr(2); } if (className.indexOf('col') == 0) { data['col'] = className.substr(3); } if (className.indexOf('g') == 0) { data['group']
Does JQuery hate ordered lists? with respect to .hide(it's not working to say the least)
Ok first off here's my code. <script type="text/javascript"> $(document).ready(function() { $("#hide").hide(); $("#show").click(function() { $(this).next("#hide").slideToggle(200); }); }); </script> <div id="toc">Table of Contents Click any of the "+"s to show sub items. <ol> <li><a href="#ghelp">General gameplay help</a></li> <li><b id="show">+ </b><a href="#nojava">Requirements to play</a> <ol id="hide"> <li><a href="#jsie7">Enabling Javascript in IE</a></li>
Hover Animate CSS css Tag "ul" "li" Clarification Question
Just getting started with js/jquery but having trouble understanding how to integrate with my external .css file. This will be an easy question for an intermediate or experienced programmer. Q: I simply want to add .hover to <li> items inside #siteLinks. What's the problem? (below) // HTML <div id="siteLinks"> <h4>Sitle Links</h4> <ul> <li><a "href=http://www.example.com">Example List Item 1</a></li> <li><a href="http://www.adbusters.com">Example List Item 2</a></li>
Appreciation
Hello everyone, Somewhat off topic i guess but hear me out ;) I just wanted to show my appreciation for what John, the jQuery team and all the people supporting it have done with/for this library. So thanks a lot for doing your share and then some to make the world (wide web) a better place, and in the process making it far less work and far more fun to be a front end developer. And thanks for inspiring us all to become better developers(JS programmers) and making JavaScript as popular as it should
Why don't click event for select option works in IE(8)
In my form a <select> with options I wrote $('#select option'). click(function () { myFunction(); }); Works fine in FF - IE8 works only for $('#select'). click(function () { myFunction(); }); but it is not at all the same thing, and myFunction is fired when as soon the select opens. and I want it is fired only when I click on an option (even if it is not a change !) I tried some other manners for the same result. The last one was to wriet
slideDown is a popdown in IE7
I'm having simple slideDown of a phrase "But are you really?" on the right side of a header. In Every major browser, the phrase slides down smoothly to the horizon. In IE7 it slides down about a quarter inch above the horizon, then at the last minute, pops down. It's ugly compared to the other browsers, but I can't figure why IE is doing it differently. It's here: http://carinsurancesecrets.com Here's the code: jQuery('#insured').hide(); jQuery('#areyou').hide(); jQuery('#insured').slideDown(3000,function(){jQuery('#areyou').css('text-indent','500px').slideDown(3000)});
$.ajax / $.post not working?
I am trying something that should be simple. My main.html page contains a form, use jQuery to AJAX post the form and return the result of that post. However, each time I try the submit, using either $.ajax or $.post, the resulting "alert()" returns my entire main.html HTML document, and nothing at all from the login.php file? I use Firefox's Firebug to trap errors/exceptions, but nothing? Hopefully someone can shed some light on this for me, my code is below. P.S. I'm using jquery-1.3.2.js Many thanks,
Merge XML Documents with jQuery
I would like to make a few ajax calls for a few XML documents and combine the results into one XML document. Specifically I have these three files: http://www.netelier.com/files/XMLMerge/doc0.xml <records> <record> <x>foo</x> <y>bar</y> </record> <record> <x>baz</x> <y>mit</y> </record> </records> http://www.netelier.com/files/XMLMerge/doc1.xml <info> <x>foo</x> <y>bar</y> </info> http://www.netelier.com/files/XMLMerge/doc2.xml <info> <x>baz</x> <y>mit</y> </info> And I would like
checking for existence of a <td> class name in dynamically created table
Hallo, i would be grateful for any help in creation a selector wich checks my table (previously created by "click handler") "td" elements for not existance of a paticular class name. thanks in advance.
Select items with multiple classes
Hi, I have some HTML like this: <div class="one two three"></div> <div class="one three"></div> <div class="two three"></div> I want to be able to highlight all of the divs which contain both the classes 'two' and 'three'. So the first and the third divs above are highlighted but the second isn't because it doesn't contiain both classes. I can see how to select multiple classes like this: $('.two, .three').css('background',''yellow'); This selects items with either 'two' or 'three' classes. I want
adding the last element of an xml file.
short: ------- (How can I count the number of elements in the XML, and like an array get the element with index (i)?) long: ------- Hi eveyone, I'm a newbie and I think my problem is straight forward, however I wasn't able to find anything in the API or by googling. I have a XML file and it updates every 1/10 second, ( an elements is added to the end of the root). I want my code to periodically check the XML the file every 0.5 second, and add the last element if it's
jQuery Multiselect plugin - speed issues
Hi Guys, Love this new forum so much better than the previous one, I am having some issues using jQuery multi-select, it works fine but really lags when I have multiple instances (can crash the browser in some cases) am using jQuery 1.3 & jQuery 1.7 as the demo (have tried updating to the newer versions but problems persists) I am using the following http://www.quasipartikel.at/multiselect/ Does anyone have any idea to speed this up, or an alternative plugin that works a little better? Thanks in
How to append HTML in an iFrame's Parent !?
Dear community, dear developers, my question concerns about how it is possible to append HTML in an textarea of an iframe's parent window. First of all, i would like to give you an short overview about the related files: * insert_media.php (a PHP file, which represents a self-made filebrowser) * article.php (a PHP file, which inherits logic to edit and create articles) ** <textarea id="content"> (the textarea which should accept HTML from "insert_media.php") I'm using CKEditor for my project and
Refresh list (getJSON and setTimeout) without intermittent effect
hi, I'm creating a list of online users. the problem is that when I refresh the list with setTimeout, the list of users disappears for less then a second and then reappear. I this because this is the time to get data from the server this is my code: function getUOL() { $("#online_box ul").empty(); $.getJSON("/uol.php?action=getUOL&tipo=1", function(data) { $.each(data, function(i, utente) { $("#online_box ul").append('<li><a href="/community/profilo.php?ID='+utente.IDUtente+'">'+utente.user+'</a></li>');
Which is best: updating database then the page with data or update page with data then the database (quicker)?
Hi I am new to JQuery, but am quickly picking it up. I have a table of data with a form to add more data using JQuery without page refresh. So the JQuery adds the data to the database then adds the new data to the table. At the moment it adds it to the database, then using JSON sends it back which I use to add to the table. So this method guarantees the data has been added before updating the page. BUT there is a delay of course for the user. What would be better for the user is update the table
[jQuery] val() and change()
I was just wondering, should a val() call invoke a change event? If not, is there a good way to emulate this behavior. Thanks Josh digitalbush.com
Need Help! - Safari overflow div shifting issue
Hi All, I am developing an annual report site which needs to be compatible with major browsers such as IE, FF and Safari at least. I have a couple of issues with the jquery effect. I have added a jquery slide reveal effect to the page which partially shows the main content div for a couple of seconds then it animates to reveal the rest of the content. I have tested it on IE6, IE7 and FF 3 on WinXP and it works fine. Also it works on the MAC in FF3. However the page has a serious issue in Safari
Accordian - I think...
Hello, I have been coding this website for my girlfriend (www.varvara.co.uk/test2 ), we are pretty happy with it, but would like to make the projects open one at a time, sort of like an accordian, so when one project is open and you click on another project it would close the one that is open and open the newly clicked one. I hope this makes sense - does anyone have any ideas of what code i need to put into place to make this happen? Best, James
ajax security
Yes, iam developing a server application with php. The users access an php file that has javascript with ajax(jquer). I know i cant stop someone from grabbing the javascript and changing it. But can i and how do i assure that when a ajax req comes to my php application it was generated by the javascript in my file and not some modified version of it. Dont need to stop it just need to beable to recognize in php that the ajax request was modified. If cross domain requests were not allowed i
Isochronous Events?
I have been a user and supporter of jQuery for a while, and I've just started a major project where we are trying to build a large interactive multimedia system without using Flash. One problem I have run into is that there doesn't seem to be any support for isochronous events. What do I mean by this? Let me give two examples: Let's say you are playing an animation using setInterval to generate a new event when it is time to display a new frame of the animation. But you want the animation to play
scaling issues with jquery cycle plugin and css
Hello, First time poster. Please go easy on me. I'm using jquery and the cycle plugin to cycle through a few images on my homepage inside a container. I'm having issues with the images in the container not scaling properly if i open the website in a smaller window and try to open it larger. It pretty much does it in all browsers and i can't seem to figure out if it's something im not setting properly with jquery or css or both. here's the website thus far: www.beaucoupla.com again, please go easy.
Sortable 3 Columns
I can get the three cols working but I cannot get the results to go to my script. I've tried dozens of different ways of the following code. Sorry for being such a noob! $(function() { $("#sortable1, #sortable2, #sortable3").sortable({ connectWith: '.connectedSortable', update : function () { var sort1 = $("#sortable1").sortable('serialize'); $("#AjaxResult").load("update.php?col=1"+sort1); var sort2 = $("#sortable2").sortable('serialize');
Loading Javascript and jquery
Hello, I have a working site that loads the following scripts: <script src="js/jquery-1.3.2.min.js" type="text/javascript"></script> <script type="text/javascript" src="js/jquery.galleriffic.js"></script> <script type="text/javascript" src="js/jquery.opacityrollover.js"></script> <script src="js/cufon-yui.js" type="text/javascript"></script> <script src="js/cufon-replace.js" type="text/javascript"></script> <script src="js/Calibri_400.font.js" type="text/javascript"></script> <script src="js/Myriad_Pro_400.font.js"
Recreate onClick function
Hi all, I have some jquery code which is performed when clicking a tab. $('.content-box ul.content-box-tabs li a').click( // When a tab is clicked... function() { $(this).parent().siblings().find("a").removeClass('current'); // Remove "current" class from all tabs $(this).addClass('current'); // Add class "current" to clicked tab var currentTab = $(this).attr('href'); // Set variable "currentTab" to the value of href of clicked tab
Good form
Hi, A question about form handling if I may. Consider the following code sample: $('input').focus(function() { var f = document.form; if (f.foo.value && f.oof.value) doThis(); /* jQuery if ($('input[name=foo]').val() && $('input[name=oof]').val()) doThis(); */ });The traditional code IMO is easier to read and type. What is considered good practice in such cases? Thanks, Roy
Handling mousemove for the document node
$("document").mousemove(function() { ... /* my function won't do much, only increments a few variables. */ }); Basically... is this a bad idea? I was planning to hook into this event on every page to create a session timeout system. It works so far in my tests. But a few things worry me: - Does this work reliably across all browsers (IE6+ etc) - Could it interfere with other javascript event handlers on the pages? Any thoughts much appreciated, Ben
Popup website screenshot when hovering over external link?
Hi, I'm looking for a jQuery code that will show a little mini screenshot of a website when you hover over an external link - been looking for a while with little joy. Any recommendations? Thanks Simon
jQuery method chaining, returned object: something I don't get
Hi, there's something I can't understand. If I do: elem1 = $('.someclass'); elemx = elem1.wrap(document.createElement('div')); elemx is... elem1? Why does jQuery return elem1 and not the created element ? Returning the created element does much more sense to me since: a) I already got a reference to elem1 if I need to do further manipulation. b) I got a references to the 'div' element I've just added. The way jQuery does it, I'll never get a references to the element I've added. Can anybody clarify
Next Page