jquery

Reference calling DOM element in jQuery.ajax() with dataType 'script'

Let's say I have the following scenario: <form action="/something.php" method="GET">Click me</div> <script type="text/javascript"><!-- $('form').submit(function(e) { $.ajax({ url: this.action, method: this.method, dataType: 'script' }); return false; }); //--></script>...

jQuery (or maybe the browser) is cache-breaking ajax loaded scripts

I'm loading a view page via an $.ajax() call with jQuery. I'm explicitly setting the "cache" option to true. Nowhere in the application are we using $.ajaxSetup() to specify otherwise. Here's the ajax request setup: $(".viewDialogLink").click(function() { $.ajax({ url: $(this).attr("href"), dataType: "html", ...

Understanding JQGrid column width behaviors

I have a tree grid with many columns, all with specified width. And boy, it looks terrible since headers are out of synch with columns below, even if I have short data in them. Specifically, if column Header title is shorter than this column width, Header shrinks down to the the size of text in header. How can I make header be exactly ...

jquery mouseout of nested div question

I'm trying to fire a function on the mouseout of a div. However when you mousover an element in the div it fires the mouseout. <div id="my_div"> <div class="another_div">X</div> </div> <script> $("#my_div").mouseout(function () { alert('weeeee, I am out!'); } </script> This makes sense but how can I test for the mouseout eve...

how to check the state of the row in jqGrid

i whant to check if the row is in edit mode. i've checked the jqGrid documentation but i couldn't find this. thanks in advance ...

Need to toggle attribute for an image map using jquery - Jquery .removeAttr

I'm trying to disable an image map onClick - and eventually I'd like to enable it if reclicked, but first things first. So to disable the imaeg map I'd like to remove the attribute "usemap" from the image when one clicks on the map. In the header I'm calling my JQuery: <script type="text/javascript" src="http://ajax.googleapis.com/...

JQuery: How to get name of a select when value is known?

Hi, I need to get the name of a select (#Dropdown) when its value is known but can't seem to get the syntax right. Here's an example: $(document).ready(function() { var countrycode = '55'; var name = $("#Dropdown[value=countrycode]").text(); // fails here if(name == 'Germany') {..... etc I can get it to work as follows i...

JQuery/Javascript - how to minimize duplicated code?

If I wanted to use the following code on multiple DIV#ID, how do I do so without duplicating code var scrollElem = $('#div1'); scrollElem.scroll(function() { /* find the closest (hlisting) home listing to the middle of the scrollwindow */ var scrollElemPos = scrollElem.offset(); var newCenter = $(document.elementFromPoint( ...

Find a value in an array of arrays

I want to determine (using JQuery) if my $(this).data contains an array with a member=x. $(this).data looks like this: 'key1':[1,28,3,4], 'key2':[5,6,7,8,9], 'key3':[15,32] Normally, I'd figure on looping through the keys and checking to see if each value array contained x, but JQuery has all these weird and wonderful functions...

get total of all input values with jqeury

Hey, I need the total of all the values from my input, the result must be displayed in the input field total that is readonly. The user can enter 1 or more values. The problem is that my var value is not correct, and how can i return the value immediately by onchange? script type="text/javascript"> $(document).ready(function() { $("...

start to load on click()

i want some content to start loading when i click on a link. i dont want it to use any bandwidth before i click on that link. also how to implement that rotating cursor animation that is seen in almost all lightboxes? ...

Rails and jQuery producing 406 error

I am getting 406 Not Acceptable error when submitting my form with jQuery. I have tried the common fix found on the web: jQuery.ajaxSetup({ 'beforeSend': function(xhr) { xhr.setRequestHeader("Accept", "text/javascript"); } }) This hasn't fixed the problem. request.format outputs text/html. I have been racking my brain all d...

Blog post comment without page refresh (ajax)

Hello everybody, I'm trying to make comments on my page just like the ones in wordpress. When you press post comments your page updates without reload. How can I do that? I understand I have to use jquery post, and I've had several attempts but for some reason my web page keeps reloading. I have a form like this : <form name="postForm...

jQuery hidden field

In jquery how do you save variable which can only be true/false into a hidden field and retrieve a value after postback? ...

Jquery Slidetoggle open 1 div and close another

I'm trying to close one div when clicking on another div . Currently, it opens multiple divs at one time. JQUERY: $(document).ready(function() { $(".dropdown dt a").click(function() { var dropID = $(this).closest("dl").attr("id"); $("#"+dropID+" dd ul").slideToggle(200); return false; }); $(".drop...

JQuery - how to use the hover() event on a list of DIVs?

I have the following HTML: <div id="panel"> <div class="listing" id="ref_1">...</div> <div class="listing" id="ref_2">...</div> <div class="listing" id="ref_3">...</div> <div class="listing" id="ref_4">...</div> </div> What I should like to do is, when someone hovers over a div.listing, to alert() to the screen the id name. M...

Help turning jQuery script into a plugin

Easy All As I've been learning jQuery lately, I decided to write my own modal window to play videos in, when the video thumbnail is clicked. It all works fine, but I'm just wondering how could I turn it into a plugin, so I could use it on different pages with different parameters etc. I read the documentation, and a few tutorials, but I...

jQuery: How can I add line break to form input?

I'm collecting information in a standard HTML form. I have, for example, <input type="text" name="UserName" id="name"/>. When the form is submitted, I want to add a line break to the value entered. So if the user entered "foo," the form would submit the value "foo\n." Here's the jQuery function I'm using: $("#formID").submit(function (...

help parse this data using jquery's xml parsing

I am having trouble parsing specific data using jquery. I have tried a few tutorials and samples online but I don't seem to have any luck with the way my data is formatted. If I have xml data as follows: <links total="2"> <link id="1"> <title>whatwhat</title> <url>http://google.com&lt;/url&gt; <img>1c9a871e2...

jQuery Form, ASP.NET MVC JSon Result

I'm trying to return a json result from a jQuery Form instance - but it keeps prompting me to download a file instead of displaying it in the window like it is supposed to... $("#ajaxImageForm").ajaxForm({ iframe: true, type: "GET", dataType: "json", beforeSubmit: function() { $("#ajaxImag...