jquery

Using jQuery to process a JSON object

My JSON object is constructed like this: var Source = { Object: [ //Array {Title: 'Test', Type: 'Pet', Category: 'Cat', Description: 'Fluffy', Count: 2 } ] }; I was able to figure out how to properly add to the 'Object' array, but I can't seem to figure out the jQuery syntax to query the object based on the property li...

horizonal and vertical alignment of div

I am using JQuery. I have a div that contains a table. I have 4 rows in the table each with one col. Each row contains a line or two of text I want to make each row with height = 100 px and have the text centered horizontally and vertically. can this be done? Thanks! ...

Onclick refresh only div

Hi i need help with refreshing div, but not auto refresh! I have my div like this. <div id="osvezi"> <?php include('moduli/skupina_artiklov/osvezi.php'); ?> </div> I want that i clicked some button they refreshed me only div osvezi. Thanks for help. ...

How to execute a javascript before dom is ready?

I need to execute a javascript before the page is start to load? how can i do it? Atfirst my script should execute, after completion of script, if i need i should load the page else i shouln't load it. For example if my script redirect to another page i shouldnot load the current page else i should load it. ...

jquery selector not working in IE

I have the following code on the page and it works in FF but not IE. I do not have any access to change this line of html code (like adding an id to better target). Could it be that it doesn't work cause there is no DOC type declared? <td align="LEFT" width="12%" bgcolor="#EEEEEE"><b>Code</b></td> <script type="text/javascript" langu...

Calculate mean when all fields are filled

I would like to calculate the mean (average) of some numbers. Every value comes from a radiobuttons that is part of a statement. For example: <div class="question_answer"> <div id="statementRow_9" class="clearfix t_a_ui_data_list_content"> <div class="question"> <p>3een tweede edit iets 1 iets 1 iets 1 iets 1 iets 1 iets ...

jQuery fullcalendar: events (as a json feed) and events (as function) issue in IE

Hi, I am using jQuery fullcalendar with Grails. I was using events (as a json feed) earlier and when the user clicks prev/next or changes views the json feed URL is called every time. Since I need to check the user session also, I changed from events (as a json feed) to events (as function) as shown below. The problem is first time it...

My Regular Expression will not Match Conditional Statement

Can anyone tell me why, even when my alert shows that my regular expression strings match, the if statement is not triggered? I have sample code below. Thanks in advance. $(document).ready(function () { $('div#primaryNavigation').find('a').each(function () { var pattern = /my-link1|my-link2|my-link3|my-link4/; var my...

is there a fork of jRails that works with Rails 2.3 and jQuery 1.4 ?

We're rewriting a site using Rails, and the old site makes extensive use of jQuery v1.4 in its templates. We'd like the old scripts to keep working, but we'd also like to use rails' javascript helpers for our own new scripts. jRails sounds like what we want, but it only seems to support jQuery 1.3. Is there a more up-to-date fork of j...

Help changing function from prototype to jQuery!

Hey I found this function online and it works fine if I use it by itself, but the rest of my document has all jQuery functions and I'd like this one to be in jQuery as well. I also get a few errors when mixing prototype and jQuery. Here is the function: function updateCommodityProduct(e) { // The response comes back as a bunch-o-J...

jQuery access input field by name[value][id]

I have some HTML code like this: <input id="fieldname-1" name="field_name[value][1]" value="1" type="checkbox" /> <input id="fieldname-2" name="field_name[value][2]" value="2" type="checkbox" /> <input id="fieldname-3" name="field_name[value][3]" value="3" type="checkbox" /> I want to access this with jQuery like: $('input[field_name...

Implementing Wordpress-style Ajax tags

This is my first question, so please be gentle with me :). I have tried to search for the answer, but I don't really know what the thing I'm after is called so can't formulate a decent search query. I'm after making the input forms on a database of online resources as user-friendly as possible, to encourage users to add some decent met...

Use Javascript/jQuery to determine where a heading breaks to the next line?

(HTML) Let's say I have within fixed-width containers. Some of these headings will be longer than one line. I would like isolate these lines and do separate things to each line. Is there a way, with JavaScript, to calculate where the heading has broken to the next line and to for example put a span around each line? ...

How to pass parameter from html to jQuery

Is there a way to passing one to many parameters from html to jQuery? The requirement is when a link on the page is clicked, toggle some text for this link, and hide text for other link(s), so I have the following jQuery: $(link1).click(function(){ $(hide1).hide(300, function(){ $(hide2.hide(300, function(){ $(t...

horizonal and vertical alignment of label in div in table row

I have code: <tr> <td align="center" style="height: 50px; text-align: center; vertical-align: middle" > <div class="hoverClass ui-widget-content ui-corner-all" style="text-align: center; vertical-align: middle;width:100%;height:100%"> <label style="text-align: center; vertical-align: middle" >Streetligh...

How to obtain user input on a clock interface

We would like to capture the user input pertaining to the hour & minute hands on a clock. What kind of clock interfaces are available to achieve this? (e.g. select 9.30 AM on the clock or select 3.45 PM on the clock) ...

Inspect an element to investigate jQuery event bindings

Hypothetical: I find a page with a button ('#bigButton'), that when clicked causes a llama ('img#theLlama') to show() using jQuery. So, somewhere (say, Line 76) in buttons.js: $('#bigButton').click(function(){ $('img#theLlama').show(); }) Now, let's say I have a big HTML page with a whole bunch of .js files included. I can click on...

Why is alert($('.myClass').hasClass('myClass')); false?

When the page loads i replace the attributes of a specific object. Then in a few lines under(maybe directly under) i do another check which always seems to fail. So i tried alert($('.myClass').hasClass('myClass')); and by all logic shouldnt that always return true? I set a breakpoint in firebug and i can see the object with the new a...

How to find the nearest common ancestors of two or more nodes ?

Hi, Users selects two or more elements in a HTML page. What i want to accomplish is to find those elements' common ancestors (so body node would be the common ancestor if none found before) ? P.S: It can be achieved with XPath but it is not a preferable option for me. Also it may be found with css selector parsing but i think it is a d...

better way to start a delay in jQuery?

I am using this code to delay the entrance of an element to the viewable area of the screen, but the first animate is wholly unecessary, other than to start a queue that delay can then delay. $("#top-message").animate({top: '-500px'},400).delay(1000).animate({top: '0px'},800).delay(3000).animate({top: '-500px'},800); is there a more s...