jquery

Easiest way to convert json data into objects with methods attached?

What's the quickest and easiest way to convert my json, containing the data of the objects, into actual objects with methods attached? By way of example, I get data for a fruitbowl with an array of fruit objects which in turn contain an array of seeds thus: {"fruitbowl": [{ "name": "apple", "color": "red", "seeds": [] ...

Morphing content based on window part focus

What I'm trying to achieve is basically have a code that will morph ( move around the page ) based on the part of the window which is currently viewed. Scenario : - actual page height : 2000px - actual screen height( pc, laptop whatever ) : 800px - 1 image of 600px - 3 div's or virtual boxes ( just to prove what I want to do ) Workflow...

Chrome not displaying Class set by jQuery or a Direct CSS property

This might seem like a bit of a design/css question but i really need some help. This is the page http://library.permilia.com/Gavin/version2.0_beta/lead.html It works on every browsers imaginable except chrome. By it works i mean it applies a class .error that sets the borders to 1px solid #f00 which is a red border. In chrome for so...

How to use jquery to remove <div> in a table?

I'm trying to remove a few rows surrounded by a div, but it doesn't work, why? $(function(){ $("#div1").empty(); }); <table id="tbl" border="1px"> <thead> ... </thead> <tbody id="tblBody"> <div id="div1"> <tr id...

How to bind events with jquery in django admin when new *Inline is added

I made a jquery function that binds some fields, but it doesn't work when i add a new inline. The main problem is that i don't know how to detect the insertion in DOM and bind it to my function. Thanks ...

What are cons if we use javascript to apply css selectors to that browser who do not support that property by default

What are cons if we use JavaScript to apply only CSS property/selectors to that browser who do not support that property by default? to keep my HTML semantic and keep free from Deprecated HTML. Is it against content, style and Behavior separation? If I make accessible site then should i only use whatever i can do with pure css. shouldn...

jQuery: See how many elements a selector matched?

If I have a selector like $.('.active'); How can I see how many items that matched? Alternatively, is there an easy way to see if more than zero elements were matched? ...

Trouble with jquery email form submitHandler

Here is the code I'm using for the submitHandler: submitHandler: function() { $('.holder').fadeOut('slow'); $('#loading').fadeIn('slow'); $.post('email.php',{name:$('#em_name').val(), email:$('#em_email').val(), message:$('#em_message').val()}, function(data){ $('#loading').css({display:'none'}); if( data == 'success') { $('...

jQuery tooltip: Trouble with remove()

I'm using a jQuery tooltip plugin. I have HTML like this: <li class="term ui-droppable"> <strong>Fall 2011</strong> <li class="course ui-draggable">Biological Statistics I<a class="remove-course-button" href="">[X]</a></li> <div class="term-meta-data"> <p class="total-credits too-few-credits">Total credits: 3</p> ...

Jquery Close/Open Multiple Toggles

Hi, I have the toggle in my menu Working successfully for the two links that I have within it. Because the top link once toggled covers the other link, there is no problem. But since the link beneath it leaves the top link exposed, a user could click that and now have two toggled items open and pretty much stacked on top of each other. I...

How to popup a jquery window to play youtube video?

I need this video to play automatically. It would be nice, this code can play videos from other sources like yahoo etc.. Is it also possible to use HTML5, instead of jquery? ...

How to pass jQuery variable with AJAX to PHP page

Trying to pass the variable "flickrurl" to a PHP page with jQuery/ajax. It works when using a plain text string and not the variable. Am I assigning the variable properly? see the full code in action here: http://is.gd/c9ytI $trash.droppable({ accept: '#gallery > li', activeClass: 'ui-state-highli...

Inserting new <TD> elements into a table row.

I have created a small application written in XHTML, JavaScript/JQuery and PHP. The PHP reads and writes to a small SQLite database. How would i go about inserting cells into a pre-scripted table. The cells would need to be configured using some information from my database. For example, below are two cells with their data retrieved f...

how to get a value which points to a function

hi, i have a value like that var myvalue = myfunction(1,2); what I need is that GETTING myfunction(a,b) as a string.. I mean not "myfunction's value" hmmm, let me explain, myfunction(1,2) returns 1+2=3 if I type alert(myvalue) it returns 3 but I need myfunction(a,b) AS IT'S TYPED when I use alert. NOT IT'S VALUE think it like...

Complicated jQuery .hover Work

The following code is giving me a lot of trouble. To note, .hover changes the background image. Firstly, how can I combine the two with .hover rather than a separate mouseenter and mouseleave? Second, How can I make it so that while the div is shifting upwards, the background image is simultaneously fading? $('div.designbox.orangehel...

Insert newline between the items of dropdownlist

Hi All, I want give some space between the items of the dropdownlist. is it possible? ex: ddl: item1 item2 item3 ...

Inline image and caption in article - conform caption's width to image's width

Here's my code: <div class="image"> <img src="image.jpg" alt="Image description" /> <p class="caption">This is the image caption</p> </div> Here's my CSS: .image { position: relative; float: right; margin: 8px 0 10px 10px; } .caption { font-weight: bold; color: #444666; } As is above, the caption will conform to the width of div.i...

In jQuery, using the "find' function, what does this expression mean: $(".divName").find('> div')

I understand the "find" function, I'm just not familiar with what '> div' means. Can anyone help? ...

Being good in jQuery == Being good in Javascript??

I'm pretty efficient in jQuery, having implementing it in several projects for my company. However, I found myself a little lost when reading stuff like node.js. Do i have to go back to basics and learn the javascript language or should i just stick with jQuery? One more thing i would like to ask: Does coding in plain javascript increa...

Having jeditable save when focus is lost?

(How) can I tweak jeditable to save the text when focus is lost from the text area? If you don't supply submit/cancel buttons, then when pressing 'Enter' the content is saved ... but I haven't found how to save the content on focus lost. ...