javascript

jQuery check if an input is type checkbox?

I'd like to find out if an input is a checkbox or not, and the following doesn't work: $("#myinput").attr('checked') === undefined Thank you once again! ...

JavaScript\JQuery - identifying if radio button value changed by click

I have a page that displays a list of records. The user can select the record status using radio buttons, e.g.: <div id="record_653"> <label><input type="radio" name="status_653" value="new" checked/>new</label> <label><input type="radio" name="status_653" value="skipped" />skipped</label> <label><input type="radio" name="status_...

How do I access the properties of a JSON Serialized object.

In my JavaScript I want to access the properties of a JSON serialzied object that was produced via a .NET web service. How do I deserialize the JSON data into an object that I can maniuplate in the JavaScript? ...

Can I make jQuery point to an XML document rather than the DOM?

I'm trying to retrofit a page to read from XML rather than the DOM, and I'd rather not use $(xml).find('blah') for every single call, and I was wondering if there was a way to point jQuery at xml, rather than the DOM. For instance, I'd like to be able to navigate my xhtml with the jQuery method as such: $('blah').whatever Is this possi...

Get myCustom.config as a JSON object

I have a fair sized config file in my asp.net application that I would to have access to in my client side script. Can anyone think of a good way to cause a section of my configuration to be serialized out as JSON and made available as a cacheable url? this is .net 3.5, and the config doesnt have any security issues. ...

simple javascript question ?

im hoping someone can explain the following usage of javascript... i have a page and it has a script tag in it and the contents look like the following (function($){ // code // and stuff })(jQuery); im just trying to understand what this does mainly, the opening parenthesis at the start the usage of the $ symbol the jQ...

Manipulating a variable containing XML with jQuery?

I'm using AJAX to receive an XML response, which I then need to manipulate. By using jQuery's context option, I can select from the XML data, but I am still unable to write to it. $('blah', xml) selects xml just fine, but $('blah', xml).removeClass( 'myClass' ) seems to do nothing to the xml variable! How can I achieve the function...

JQuery submit form after clicking on link

Here is the JQuery: $(document).ready(function() { $('#autosave').click(function() { var url = window.location.pathname; $postData = $('#content form:first').serialize() + '&' + $('#content form:first .input-submit').attr('name') + '=Save'; $.post(url, $postData, functi...

Close a control when enter is pressed

I have a custom datepicker control inside a grid . It does not close and return to the grid when user presses enter or escape. I have the javascript code for trapping the enter key, but I need the next line of Javascript that will close the control and return to the grid. At present, I can only close the control by clicking on another...

The right way to do radio buttons?

So.. I have been trying to avoid radio buttons at all cost in my web development projects because I just cant figure out the right way to code them. Do you set a label for radio button.. if so, how does that work for screen readers. The way I have been doing most of my forms is by using un-ordered lists. Each input being a list item. ...

jQuery Image Replacement

I would like to replace a image with another image when a link is clicked. I have three images that each go to a specific link. So for instance, link one needs image 1, link 2 image two. etc... I've figured out how to do the replacement: $(function() { $("a#t2").click(function() { $("#floatleft img").replaceWith('<img src="i...

Modifying document.location.hash without page scrolling

We've got a few pages using ajax to load in content and there's a few occasions where we need to deep link into a page. Instead of having a link to "Users" and telling people to click "settings" it's helpful to be able to link people to user.aspx#settings To allow people to provide us with correct links to sections (for tech support, et...

How to inherit from the DOM element class

I want to write some javascript classes which extend DOM nodes (so that I can then insert instances of my class directly into the DOM), but am having difficulty finding out which class/prototype I should inherit from. eg function myExtendedElement() { this.superclass = ClassA; this.superclass(); delete this.supercl...

jQuery live('click') firing for right-click

I've noticed a strange behaviour of the live() function in jQuery: <a href="#" id="normal">normal</a> <a href="#" id="live">live</a> $('#normal').click(clickHandler); $('#live').live('click', clickHandler); function clickHandler() { alert("Clicked"); return false; } That's fine and dandy until you right-click on the "live" l...

jquery, json and xml

I have a database at zoho creator. They feed me a json of the database content. I have trouble to parse and display that data with jquery or php or in html Question : So how do I capture json data, and save (convert) it to file as XML. With the xml file I can parse it with jquery xpath easily... the "file" will be a local database, as a...

Queueing setTimeout in javascript

I need to flash an element off and on. This works but I don't really like the code. Is there a nice way of doing this? setTimeout(function(){ toggle(); setTimeout(function(){ toggle(); setTimeout(function(){ toggle(); setTimeout(function(){ toggle(); }, 100); }, 100); }, 100); }, 100); I'm u...

jquery inserting all stylesheets into iframe

How can I insert all of a parent window's stylesheets into an iframe's head(samedomain)? My attempted code based on a similar question: function () { var d = frames[0].document; var stylesheets = $("link").outerhtml; d.open(); d.write( '<html><head>'+ stylesheets + '<style type="text/css">'+ '<\/style><...

How to add a delay to a jQuery fadeout?

I'm designing a navigation bar for a site, and I'm trying to noodle out how to get the submenu that appears with each tab to stay visible after the cursor leaves the tab. Since it fades out immediately after the cursor leaves, I can't set a function on the submenu. So what I'm trying to do is introduce a setTimeout() to the out side of...

Pass Value From Parent Form to Child Form using javascript showModalDialog

if i want to pass in my value for confirmation box!!! so lets say i want to delete item no 1 so i checked the check box then when i pressed the delete button. the popup box come out with detail item no 1 in it. i have implemented the popup using show modal dialog (JavaScript) but i still cant get the parent value into the child form! f...

How to do an action when an element is added to a page using Jquery?

When I add something of the class "myClass" I want to call a function on this element. It would be something in the lines of: jQuery(".error_message").live("load",function(){ alert("test"+this); }); ... except this doesn't exist. What's the best way of doing this? ...