jquery

how to organize javascripts using rails and jquery

Hi, i'm working in a big and rich rails web application using tons of javascript. I would like to know if anybody has a tip to organize the javascripts. Today i'm generating a new file named controller.js and adding it to my views using content_for. The problem is, some files are becoming big and sometimes, i need a function from one co...

Expanding DIV slides behind DIV beneath it...

I'm not sure that I'm going to get an answer here, as I'd need to post a lot of CSS and html to get a working recreation, however... I have structure something like this: <fieldset> <legend>Test A</legend> <h3>Test A</h3> <p> Something here. </p> <div style="display:hidden;">I'm dynamically displayed</di...

Easy way to post form values using jQuery

I have a simple form that I wish to postback to the server in an easy fashion and get the result. I am using a custom ISAPI plugin on the backend so using JSON or other funky stuff isn't an option. How best can I do this? Edit: I would also rather not use external plugins, if possible ...

jQuery: how to use :checked, if my element is $(this)

hi, how can I use the option :checked with $(this) in jQuery ? i.e. $(this:checked) ? thanks ...

How to be a jQuery no.conflict expert?

How to be a jQuery no.conflict expert? I mostly face jQuery conflict errors with Prototypes JS. and I'm nota jquery expert. Can I still solve all conflict problems. how to get expertize to solve conflict issues. How to know whole code is jquery. what if simple javascript and jquery code mixed in one js file? What if inside external j...

Should we wrap jquery code $(document).ready(function(){ in external js also

When we write inline javascript in then we keep code inside $(document).ready(function(){ // Your code here }); and if i want to paste code // Your code here in external .js file then should i keep code inside this $(document).ready(function(){ // Your code here }); or we can have without this // Your code her...

JQuery Autocomplete - format listing and only return a part to the text box

I'm using the JQuery Autocomplete and it's working just fine. I'm using it to allow someone to search for users out of a database by searching on last name or id number. Right now the drop down list that is created is the resultes of a SQL query and looks something like: $row_rst['lName'] . ', ' . $row_rst['fName'] . " - " . $row_rst['...

Jquery check if control is empty and display != "none", Why does not work?

The following if statement. emptyFields = false; $(".ClassNanme").each(function() { if(($.trim($(this).val()) == "") &amp;&amp; ($(this).css('display') != 'none' ) { emptyFields = true; return false; // break out of the each-loop } }); But does not work, I don't know how to check if the css property displ...

jqeury: best way to place dom element in the center of viewport

hello! i'm looking for a proper way of placing popup div-elemnt in the center of current view area. for example: we have some div element with {display:none; position:absolute} and few buttons, one on the top of document, second in the center and last one, somewhere in the bottom. By clicking on any of this button, div should appear in t...

jQuery: submit a form when the checkbox is selected

hi, I have a form, and I want automatically to update it when I click on a checkbox. This is my current code: $('.option img').click(function() { $("#views-exposed-form-Portfolio-page-1").submit(); }); However, the selected checkbox is not stored before the form is submitted, and so the selection has not effect. thanks ...

jQuery $.ajax Not Working in IE8 but it works on FireFox & Chrome

I have the following ajax call which works perfectly in Firefox and Chrome but not IE: function getAJAXdates( startDate, numberOfNights, opts ) { var month = startDate.getMonth() + 1; var day = startDate.getDate(); var year = startDate.getFullYear(); var d = new Date(); var randNum = Math.f...

Exceptions thrown in jQuery AJAX callbacks swallowed?

Is there any way to handle exceptions thrown from AJAX callbacks in jQuery, other than adding a try..catch block to each callback? The error function is not called in this situation. $.ajax( { url: 'myurl.rails', success: function( data ) { throw 'Oh no!'; }, error: function ( xhr, textStatus, errorThrown ) ...

Does anyone know why jquery dialog is showing stale content on ajax update ?

I have a series of links and when i click on a link i want to show a dialog with detail information. This detail is returned from an jquery ajax request. I am using the following code below to show a partial result through ajax onto a jquery dialog. Here is the jquery code: $(document).ready(function() { $('a.click').live('click', ...

Click event on submit buttons only fires once

I subscribe to the click event on all submit buttons on my page once loaded. All buttons fire off the correct event when clicked, but this only works once. If you click any two buttons in a row the second button submits the form normally as opposed to running the script. What am I doing wrong?. Note: I load the form data from "myurl...

How to set width and height dynamically using jQuery

I would like to set the width and the height of the div element dynamically using jQuery. I was trying to replace <div id="mainTable" style="width:100px; height:200px;"></div> with this: $("#mainTable").css("width", "100"); $("#mainTable").css("height", "200"); but, it does not work for me. Please help to understand why. Thank y...

Jqgrid having row as dropdown list box

I am using new version of Jqgrid http://www.trirand.net/demoaspnetmvc.aspx I need to display first two colums has dropdown list box in the grid for all resulting users.. can anyboy help me out how to do this? Thanks ...

Is there a JQuery DOM manipulator/CSS selector equivalent class in PHP?

I know that I can use DOMDocument and DOMXPath to manipulate XML files. But, I really love JQuery, and it would be great if there was something more like JQuery in the PHP world that I could use for sever side DOM manipulation. NOTE: I'm only interested here in how JQuery Selects and Manipulates the DOM, not all the other parts...

change the value of the input element

Hi, the following code is costing me a lot of precious time, can anybody help me on this?? <div id="i"> <input id="Text1" type="text" value="hello" onClick="hello();"/> </div> <script> function hello() { var x = $("#i").html(); var y = $(x).val(); alert(y); } </script> in the case above the word "h...

Javascript: How to filter object array based on attributes?

I have the following JavaScript JSON array of real estate home objects: var json = { 'homes' : [ { "home_id":"1", "price":"925", "sqft":"1100", "num_of_beds":"2", "num_of_baths":"2.0", }, { "home_id":"2", "price":"1425", "sqft":"1900", "num_of_beds":"4"...

Are jQuery and GWT comparable frameworks?

At work there's a bit of discussion around what client side framework we should use for our front end web applications. Currently it's a showdown between GWT and jQuery and I'm kind of on the fence but leaning towards jQuery. From what I can tell, GWT and jQuery are trying to solve different problems but are compared to each other becau...