jquery

How to make a jQuery plugin (the right way)?

I know there are jQuery cookie plugins out there, but I wanted to write one for the sake of better learning the jQuery plugin pattern. I like the separation of "work" in small, manageable functions, but I feel like I'm passing name, value, and options arguments around too much. Is there a way this can be refactored? I'm looking for sni...

Temporarily Disallow JQuery Toggle

I have a menu that is toggled when a user selects a link. The menu had different show and hide animations attached, and I want to prevent toggling while the animation is running. The following snippet works, but flips the state of toggle if the link is clicked quickly twice (i.e. if the user clicks the link quickly twice, the next click ...

checking and replacing a value in an array jquery

i have a table of data: <table id="disparities" class="datatable"> <thead> <tr> <th scope="col">Events</th> <th scope="col">White</th> <th scope="col">Black</th> <th scope="col">Hispanic</th><th scope="col">Asian/Pacific Islands</th> ...

Jqgrid search option hides the grid table

The issue is when I click on search option (on pager) it shows the search window but the grid gets hide. I'm including the jqmodal.js file. But what I'm ignoring on the code below? css files: jqModal.css jquery-ui-1.8.custom.css ui.jqgrid.css ui.multiselect.css jquery.searchFilter.css js files: jquery.min.js grid.base.js grid.c...

I am using jquery ajax using text() but any html written in the XML doesn't render?

So I have Jquery Ajax working real nice, but an issue I am having is in my XML if I want to bold a work or Italicize a sentence, if I do it in the XML using HTML tags it will not show up. I am pretty sure it is due to using the .text(). Any suggestions on a work around for this? $(document).ready(function(){ $.ajax({ type: ...

Comparing two large sets of attributes

Suppose you have a Django view that has two functions: The first function renders some XML using a XSLT stylesheet and produces a div with 1000 subelements like this: <div id="myText"> <p id="p1"><a class="note-p1" href="#" style="display:none" target="bot">✽</a></strong>Lorem ipsum</p> <p id="p2"><a class="note-p2" href="#" s...

Monitoring DOM Changes in JQuery

Is there a way to detect when the disabled attribute of an input changes in JQuery. I want to toggle the style based on the value. I can copy/paste the same enable/disable code for each change event (as I did below) but I was looking for a more generic approach. Can I create a custom event that will monitor the disabled attribute of s...

How do you find out what element type the root element is with jquery

I'm sending an ajax request that will either give me an error or a userID <?xml version="1.0" encoding="UTF-8"?> <error>1000</error> <?xml version="1.0" encoding="UTF-8"?> <userID>8</userID> how can I find out if the root element is error or userID using jquery or just javascript in general. Using the find method doesn't appear to wo...

CSS/Jquery How can I display a div directly under button?

I have a button that when hovered displays a div. How can I postion this div to appear directly under the button when displayed??? <script type="text/javascript"> $(document).ready(function(){ $(".plans").hover(function() { $("#planssubnav").show("slow"); }, function(){ $("#planssubnav").hide("slow"); }); }); </scri...

Adding a close button to a jQuery Accordion script

Hey guys, I am wondering if there is a way to add a close button (or action) to this accordion script I'm working on. I have no jquery knowledge, but am eager to learn it. Here is my accordion code: $(document).ready(function(){ $(".accordion .intro:first").addClass("active"); $(".accordion .more:not(:first)").hide(); $(".accordion...

jQuery show image when thumbnail clicked

Hey all, I have a list of 4 thumbnail images. When one of these thumbnails are clicked, I want it's bigger partner image to show off to the side. Only one bigger image can be shown at once. As it is right now I am stacking all 4 bigger images on top of each other and have a z-index set on the #1 image so it's sitting on top of the stack ...

set Enabled = "false" to radiobuttonlist then can not toggle enable/disable

I am able to use jquery toenable/disable radiobuttonlist based on the checkbox value. But the problem is that I want to disable radiobuttonlist at the first time. Then toggle its enable/disable by checkbox later. So I have But after I add: Enabled = "false" to my radiobuttonlis...

Do you need to worry about caching when using jQuery's $Post?

I know that $post() is a short hand for the ajax() in jQuery. I also saw that ajax() has a cache parameter that is true by default. My question is: Is it dangerous to use $post() to get back html from the server if you DON'T want caching since the default for ajax() caching is true? Or is a post never cached? I wasn't sure if it was ...

jQuery: Circulate plugin: stopping midway in animation

Has anyone had any luck in altering the plug-in code so that one might animate an object in "3d" space for only a 1/4 or 1/2 turn? As it stands, an object must complete a full circle before stopping or looping. And for those who haven't seen it yet: http://css-tricks.com/examples/Circulate/ ...

JQuery datepicker not working

I'm completely new to JQuery and MVC. I'm working on a pet project that uses both to learn them and I've hit my first snag. I have a date field and I want to add the JQuery datepicker to the UI. Here is what I have done: Added <script src="../../Scripts/jquery-1.3.2.min.js" type="text/javascript"></script> to the site.master In...

small scale website - global javascript file style/format/pattern - improving maintainability

I frequently create (and inherit) small to medium websites where I have the following sort of code in a single file (normally named global.js or application.js or projectname.js). If functions get big, I normally put them in a seperate file, and call them at the bottom of the file below in the $(document).ready() section. If I have a f...

what would be the best method to override the validation of data in an mvc application

I have a very large form I need the user to complete. They need to be able to save their progress whether valid or not. When they have come back at a later time, they can update and make valid - then submit the data. I am using client side scripting (xval), server side attributes on the domain model. ...

Jquery UI Tabs only reload the tab contents

<div id="example"> <ul> <li><a href="ahah_1.aspx"><span>Content 1</span></a></li> <li><a href="ahah_2.aspx"><span>Content 2</span></a></li> <li><a href="ahah_3.aspx"><span>Content 3</span></a></li> </ul> </div> I am using Jquery ui tabs in Ajax mode. When my page ahaha_1.aspx postbacks my main page ...

JQuery Progress Bar Inline Text

Hello, I am trying to use the basic progress bar however I am unable to figure out the css/command to actually put some text inside the bar. I am using this progress bar: http://docs.jquery.com/UI/Progressbar however I am open to other ones if they are just as simple to implement. I want it to display in the left corner some static info...

Is it faster to construct jQuery objects using method syntax or pure html?

Using jQuery what provides for faster object construction: With the HTML code $('<dd class="foo baz" id="bar"> foobar </dd>') Or with the pure object/method variant $('</dd>').addClass('foo').addClass('baz').id('bar').text('foobar') I'm not sure how the internals work, feel free to supply a high level summary. ...