jquery

Check of specific radio button is checked

I'm having trouble after looking at the jQuery docs. I'm just trying to return true/false in one my my jquery methods depending on the check of a certain radiobutton and if it's selected or not I've tried several things but have not been able to get this right: <input type="radio" runat="server" name="testGroup" id="test1" /><label fo...

How to return an array from jQuery ajax success function properly?

Hi, I have this code: TheObject = { getArray: function(){ var groups = new Array; $.ajax({ type: "POST", url: "link.php", success: function (data){ var counter = 0; $('g',data).each(function(){ var group_name = $(...

JQuery events don't work with ASP.NET MVC Partial Views

I am trying to get JQuery events to work with partial views in ASP.NET MVC. However, after you load a partial view through Ajax, JQuery seems not able to fire events for any of the elements in the partial view. I suspect that this issue will also happen if you are using other frameworks or JavaScript libraries to load partial html code w...

Better ajax toggle performance for checkbox attr with select change

Im creating a simple message system with a mail inbox like UI. I have a select box that witll control a list of check box one for each message. It works fine but i need it with less code lines. heres my code: jQuery("#select_deselect").change(function(){ switch (jQuery(this).val()){ case 'unread': jQuery("input[class=new_messa...

Passing arrays in ajax call using jQuery 1.4

The following code works for me using jQuery 1.2.6 but causes a broker error in 1.4. var items = new Array(); items[0] = "Item 1"; items[1] = "Item 2"; items[2] = "Item 3"; var dataToSend = {'_service' : myService, '_program' : myProgram, 'selections' : items} ; $.ajax({ type: "post", url: myURL, dataType: "text", data: dataTo...

jquery to prototype format question

I'm currently using the facebox_render plugin for rails, and am trying to get it working without jquery (so using prototype). I've got it 99% functional, but there's one line I'm having difficulty with. how would I write the following using prototype? link_to_function(name, "jQuery.facebox(function(){ #{remote_function(options)} })", h...

Help using SimpleModal plugin (JQUERY)

Hi I am trying to use the Simple Modal plugin working, but when I click the link, the dialog box comes and goes away quickly. I am just trying to get a simple dialog running as shown in http://www.ericmmartin.com/projects/simplemodal/#examples. Please advise how to make it running. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitio...

How do I add slashes to a string in Javascript?

Just a string. Add \' to it every time there is a single quote. ...

passing multiple values from multiple textboxes in jquery

Below is the jquery script that takes one input value from textBox1 and pass it to a web method then returns the name of the person and displays it in textBox2. The web method only takes one parameter, the user initials. <script type="text/javascript" > $('#textBox1').live('keydown', function(e) { var keyCode = e.keycode ...

jquery slide up and down with animate wont stop sliding

i have a photo with some content on top of it (name, desc, price) the content is in a ul. in default state the ul only shows the name by setting the absolute position of the ul toward the bottom of the image and then hiding the overflow with a mask div. then when you mouseover the ul slides up showing the whole info as long as you stay o...

How to use jquery Attr() to select only first attribute?

Hello, I have a div as follows: <DIV CLASS="variable productPopup"></DIV> When assigning it to a var, how do I only select variable? Please note that variable changes, so it needs to select the first item, not literally the words "variable" var ID = $(this).attr("class"); ...

jQuery figuring out if parent has lost 'focus'

I'm stuck on figuring out the logic to make a drop down menu keyboard accessible. The HTML is structured as such (extra class names used for clarity): <ul> <li class="primaryMenuItem"> <a href="">Link 1</a> <ul class="popUpMenu"> <li><a href="">Sub Link 1</a></li> <li><a href="">Sub Link 2</a...

jQuery Event only firing for first named element.

I have hyperlinks, all are named 'mylink'. They should all fire the same event, but only the first element named 'mylink' actually fires. My code is as follows: $(document).ready(function() { $("#formID").validationEngine() $('#mylink').click(function(e){ var goto = $(this).attr('href'); //get the url ...

How to identify the partial view that is returned in an Ajax callback

I am retrieving a partial view with Ajax that is a form that can be submitted. If the form is submitted and ModelState is not valid I return the view and hookup the buttons again for the form. With that I get the validation error messages which works quite nice. But when ModelState is valid I want to return a different partial view that ...

jQuery -- The right way to add a child element?

This is my first day of jQuery, so bare with me. Currently, I am adding an element to my parent container by doing the following: var uploadedContainer =$('#uploadedimages'); var uploadedItem = '<div><span>'+file.name+'</span><span><a class="mylink" href=remove.aspx?img='+safeUrl+'>Remove</a></span></div>'; uploadedContainer.append(upl...

Simple regex to extract contents between square brackets in jQuery

I have a bunch of elements with names similar to "comp[1].Field" or "comp[3].AnotherField" where the index (1 or 3) changes. I'm trying to extract the index from the name. Right now I'm using: var index = $(":input:last").attr("name").match(/\[(\d+)\]/)[1]; but I don't feel like this is the best way to do this. Any suggestions? ...

jQuery Tabs causes problems in IE8?

I am using jQuery Tabs with jQuery 1.3.2 run locally. The tabs get created just fine, but IE tells me that the site is running content that could be a security risk (which is annoying, but maybe that's what always happens when IE sees any javascript...I wouldn't know because I don't use IE). Anyway, I have 3 tabs, and whenever the user g...

What is the best dropdown navigation alternative to Superfish?

I know superfish is amazing, but the terrible CMS we are using conflicts with it in IE6 (hovers break in IE6 when the CMS applies a selected class to the li). I don't know how, but feel free to look at valitics.com/test1. It can be mootools, scriptaculous, whatever, I just need a good alternative to superfish. ...

Select next rows that have ID.length > 0 in a table

Using only jQuery, how would I select the next rows in a table with an ID length > 0? In my code, I'm using a hybrid of jQuery and javascript. And it works fine. However, I'd like it to be all in jQuery. var rowsWithIds = new Array(); var rows = $(myTable).nextAll("tr"); for(var i=0; i < rows.length; i++) { if(rows[i].id.len...

jQuery slider question (need to improve it)

I have it set to step between values, and each value represents some information that is displayed. I want it to be more fluid, though. How would I go about having it so that when you slide the slider, it isn't in steps, but still changes "slides". Current code: $(function() { $("#slider").slider({ min: 1, max: 5, ...