jquery

How to remove options from select element using jquery?

I have n drop-downs like this: <select id="select1"> <option>1</option> <option>2</option> <option>3</option> </select> <select id="select2"> <option>1</option> <option>2</option> <option>3</option> </select> with identical options. All the choices should be unique, so once the option is selected in one combobox, it should b...

Looking for a jquery plugin to resize/expand browser if too small?

Is there a jquery way or plugin to detect the visitor's browser window size when they first come to the page and auto stretch the browser for them if it's too small? It's a pretty common thing that I've seen done a few times, so I'm guessing someone here will know about it. ...

edge case for selecting a checked radio input with jquery

Hi all! I have a problem selecting a checked radio button with jquery. The radio buttons are generated by a function from a MVC that i'd rather not change and its name is like id[number]. Simply put, I have to check if any of these buttons are checked: <input type="radio" name="id[1]" value="1"/> <input type="radio" name="id[1]" value...

How to check visibility of multiple div's in simpler way?

Currently i'm using below code which works well. $("#topperAtBaseLevel:visible, #lowerAtBaseLevel:visible, #midAtBaseLevel").hide(); any optimised code? (i cant use same class) i mean how to use :visible rightly? ...

Is jQuery.parseJSON able to process all valid json?

This piece of valid json (it has been generated using php's json_encode): {"html":"form is NOT valid<form id=\"articleform\" enctype=\"application\/x-www-form-urlencoded\" method=\"post\" action=\"\"><dl class=\"zend_form\">\n<dt id=\"title-label\">&nbsp;<\/dt>\n<dd id=\"title-element\">\n<input type=\"text\" name=\"title\" id=\"title\"...

How can I filter using the current value of a text box in a jQuery selector?

I have a validation script that checks for data-* attributes to determine which fields are required. If an element has the 'data-required-if' attribute (which has a jQuery selector as it's value), it checks to see if any elements are found that match that selector. If any are found, the field is required. It does something similar to the...

How to add divs inside a div using jquery

Hi, I am trying to insert a div inside another div using add() of jquery but it is not working <div class="column" id="col1"> <div class="portlet" id="panel1"> <div class="portlet-header">1.Feeds</div> <div class="portlet-content">Lorem ipsum dolor sit amet, consectetuer adipiscing elit</div> </div> <div clas...

jQuery: modify hidden form field value before submit

I have the following code in a partial view (using Spark): <span id="selectCount">0</span> video(s) selected. <for each="var video in Model"> <div style="padding: 3px; margin:2px" class="video_choice" id="${video.YouTubeID}"> <span id="video_name">${video.Name}</span><br/> <for each="var thumb in video.Thumbnails"> ...

jquery modal popup read from a file

For the below code, there ia a form in the location /home/form.php .How can this form be opened with the below code.i.e, the modal dialog $dialog.html(data) .dialog({ autoOpen: true, position: ['right','bottom'] , title: 'Emp Form', draggable: false, width : 300, height...

Getting .focus() to work in jQuery 1.4.2?

I am trying to validate an input field when it loses focus and re-focus the field if the validation fails. But I cannot seem to get the field to re-focus. I have written a test case at http://jsbin.com/ahepo/edit . It is failing in Firefox 3.6.2 and IE 8, but working in Chrome 4.1. ...

How to hide an dom element after creating it on the fly with Jquery ?

I am trying to build a form where users can add a text field by clicking on a "add option" button. They can also remove added fields by a "remove option" link created on the fly by Jquery, along with the text field. My code looks like this : $(document).ready(function(){ $("#add_option").click(function(){ var form ...

add autocomplete facility for dynamically added input tag

I am creating autocomplete functionality on an input tag using following code. $('.query').autocomplete({ serviceUrl:'http://localhost/main/finder.php', minChars:2, delimiter: /(,|;)\s*/, // regex or character maxHeight:400, width:400, zIndex: 9999, deferRequestBy: 0, //miliseconds onSelect: function(val...

Weird Behavior with Jquery image slideshow... Help!

I built a jquery slideshow based on the tutorial found here: http://www.queness.com/post/152/simple-jquery-image-slide-show-with-semi-transparent-caption It seems to be working perfectly fine, except that it behaves strangley right at the beginning when it displays the first image. The first image appears like normal and then flashes, f...

tinyMCE not working with jQuery 1.4.2 in IE6

I'm having trouble getting tinyMCE to work with the new jQuery 1.4.2 on IE6. In my project, we've been using tinyMCE with no problems with jQuery 1.3.2. But now the upgrade has brought on a weird problem. Whenever I click any button in the toolbar (whether it be a custom one or the standard ones like bold, italics), IE6 fires an unload e...

how to properly use jquery .stop() ?

Hello! On this page: http://www.arvag.net/old/smsbox.de/ when you hover over "Informationen" and "Über uns" you get sub menu shown. When you move mouse away it hides. Normally i have problem with jquery making queue for every single hover i make, and then i just keeps on animating all those hovers. I tried to implement stop() but just...

jQuery & IE crashing on $('#someDiv').hide();

Well after a while of scratching my head and going "huh?" trying to figure out why IE would straight up crash when loading one of my pages loaded with jQuery goodness, I narrowed down the culprit to this line $('div#questions').hide(); And when I say IE crashes, I mean it fully crashes, attempting to do its webpage recovery nonsense t...

How to get top/left x/y of image map with javascript / jquery?

Using jQuery's position() or offset(), I can't seeme to get the top/left coordinates of an image map area. It works in FF, but nothing else - no webkit, IE, Opera. $('area').bind("click",function(){ alert($(this).position().left); }); <area shape="rect" coords="14,25,205,150" href="#"> Anyone know of a different way to access these...

Scroll to a text position in Javascript

I have a real-time HTML editor, with a textarea on the left for code entry, and a 'preview' DIV on the right to contain the preview of the code entered. At the moment, when editing the code in the left pane, the preview just sits where it is, so often the part of the code you're editing is not in the visible area of the preview (especial...

Jquery+Ajax Writing results of a multiple link AJAX request.

Hey all, Thanks to everyone out there helping newbies like me. So far I have this: $("td a").map(function () { var theurls = $(this).attr("href"); $.get(theurls, function (tu) { if ($('#blah', tu).length) { $("td a").after("Yep"); } if (!$('#blah', tu).length) { $("td a").after("Nope"); } }); }); It ...

jquery, get url segment - ajax

Hello! Say I have a list of items from a database. Next to each item there is a delete link. the links look something like: http://example.com/exp/delete/1 - 1 is the ID of the record I want to delete. How can I grab the ID to pass through AJAX? Thanks ...