jquery

Apply conditional statements within string output in JavaScript.

Hello, I'm using a jQuery plugin named "jParse" to parse an XML file like so: $('#content').jParse({ ajaxOpts: {url: 'data.xml'}, elementTag: ['title', 'description'], output: '<h2>jpet0</h2><p>jpet1</p>' }); As you can see, the "jpet" variables correlate with the elementTag array. How would I check to see if the jpet var contain...

Dynamically Auto-Linking instance variables to object functions in javascript / jquery?

Hey all, I'm trying to create a robust audio player in javascript (& jQuery). I know that there are other players out there, but I'd like to try creating my own (so please don't refer me to jquery plugins). This is essentially what I would like to do: Main.js: var player = new Player(AudioObj); // Audio object links to Audio class (n...

jQTouch loading remote data

I'm using jQTouch which is an implementation of jQuery with some extra stuff for mobile devices. I have a div with id=testinner. When I use this code, it works fine from a local file: $("#testinner").load("test.html"); But if I test with a remote file, nothing loads $("#testinner").load("http://www.google.com"); Anyone have any id...

Using jquery, how to I animate adding a new list item to a list?

I have a simple javascript function that allows me to add an item to a list. Note that I use JQuery... function prependListItem(listName, listItemHTML) { //Shift down list items... $("#" + listName + " li:first").slideDown("slow"); //Add new item to list... $(listItemHTML).prependTo("#" + listName) } The 'listName' ...

How do I parse this JSON?

I'm using a book API that returns the following var _OLBookInfo = { "ISBN:234234234234234": { "bib_key": "ISBN:234234234234234", "preview": "noview", "preview_url": "http://openlibrary.org/b/adsfasdfa", "info_url": "http://openlibrary.org/b/adsfasdf", "details": { "publishers":...

delay the showing of a ajax loading gif using jQuery

What is the best way to put a delay on the showing of a ajax-loader gif. When I click a button the loader gif shows and hides even if the time taken is a few hundred milli-seconds, this gives the browser a kind of flicker. What I want is to say only show the gif if it takes more than say 1000 milli-seconds to complete the ajax request. ...

jquery overlay wrong positioning

I have a div (with class triggers) with the images and that div is in a div with id container. the positioning for the container div is set to relative which causes the overlay to appear in the bottom right corner and when the image is larger it will go outside the screen. how can I fix this? I read this one but that would not be a goo...

Running jQuery call in Firebug Console

Sorry, new to Firebug. I really find being able to run javascript in the Firebug console window helpful. However, I don't seem to be able to run jQuery calls in the console. For example, in my executing javascript in my page, I may make the call to get a value: jQuery('#an_element_value').text() However, I cannot execute this in...

WOT Bookmarklet

I'm trying to write a bookmarklet that will allow me to view the Web Of Trust (WOT) ratings for all the links on a page before visiting them. While WOT provides their own bookmarklet, it is not very useful since you need to visit the page first before viewing the rating. This will be used on SeaMonkey, so I can't just install the WOT e...

When do I need to use JSON and XML?

I know there are a lot of sources which explain this, but they just talk about storing key/value pairs in an array or in an object. I can't understand why or when should I do this, although I always use jquery's AJAX. As an example, if I make a forum when do I need this? Can someone give real world examples? The same goes for XML. It s...

unbind click event for last list element

Hi all, I was trying to customize the jQuery autocomplete plugin... I have to add a turn off button at the end of the result set returned. The problem is that I have added a button to the returned result set but when I click on the button the HTML of the button goes into the text box.... I hope I am making some sense... From what I und...

How to add a warning modal to delete

I have the following MySQL for a delete button. DELETE FROM mytable WHERE id = $id I want to add a jquery modal to confirm to proceed. "Are you sure to delete? Yess | No" If you click YES then it will execute to delete, if it is NO then exit the modal and go back to the page. --Updated-- The id in each ancho is added dynamically. ...

clear textbox after form submit

I have a form which posts using ajax and reloads the div underneath. I need the textbox to clear when the submit button is pressed. <form name=goform action="" method=post> <textarea name=comment></textarea> <input type=submit value=submit> </form> ...

JQuery classname selector starting with??

Hi there, I have the folowing html markup. <DIV class="bubble bubble_white"> <DIV class=bubble_large></DIV> </DIV> <DIV class="bubble bubble_black"> <DIV class=bubble_large></DIV> </DIV> I want to select the classes bubble bubble_white and bubble bubble_black. I was thinking about the code underneath but didn't work. $(".bubble...

Tricky data conversion excercise

I have weather history data which I need to plot on a web page using (highly recommended) jquery flot. The app behind is in RoR. One of the data series describes overall weather state for a date such as 'heavy showers', 'light snow', etc. Now flot expects decimals in data input. Flot also allows to reformat data when it comes down to s...

Insert data in a form inputbox with jquery

Hello. In my main page, I have a div showing some external html content. Here I have some radio buttons. When the user select a radio, the form of the parent page shound be updated. The external code is like this: function updateForm(val){ $('#photourl', window.parent.document.frm).val(val).change(); }; ... <input name="photo" id="ph...

Is this JQuery valid?

Is this JQuery valid? $("[name=enableTooltip]:checked") What does it does? ...

how to get scrollTop of an iframe

jQuery's scrollTop returns null when window is an iframe. Has anyone been able to figure out how to get scrollTop of an iframe? more info: my script is running in the iframe itself, the parent window is on another domain, so i cant access the ID of the iframe or anything like that ...

ASP:Button don't works in a jquery dialog

Hi have a jquery dialog: the js source is: $(document).ready(function() { $("#DialogConfirmationDiv").dialog({ bgiframe: true, autoOpen:false, height: 140, title: "Confermi l' invio?", modal: true }); } the html source is: <div id="Dialo...

Wrapping Multiple Elements (jQuery)

I've this piece of HTML: div.content div.one content div.two content div.three content I want to add two divs on top and bottom and wrap one div around it so it becomes: div.top div.wrapper div.content div.one content div.two content div.three content div.bottom I'm aware of the sev...