jquery

Hiding multiple elements of a specific class or ID using jquery

Hi, I would like to know if its possible to hide all the HTML elements (divs in my case) with a specific class name or ID using jquery. Thanks Thanks for the sympathy, I already know the hide() function but the problem is there are multiple divs which I want hidden but the my code only works on the first on or doesnt work at all. Belo...

Problem in input value and my jquery code

Im using this code for my inputs: $(document).ready(function(){ $('.add-news').each( function () { $(this).val($(this).attr('defaultValue')); $(this).css({'color':'#686868' , 'font-size':'11px', 'font-weight':'bold'}); }); $('.add-news').focus(function(){ if ( $(this).val() == $(this).attr('defaultValue') ){ $(this)...

jquery ui datepicker back button jumps to 1899

I must be missing some setting or something, but when I use the back button the datepicker jumps to 1899 from the current year. Has anyone else seen this and fixed it? (You can see the different combos I've commented out.) $('.dialog-search,#from') .datepicker({ defaultDate: 'c-1m', dateFormat: 'yymmdd', //changeM...

Javascript checkbox selection order

How would I go about detecting the order in which checkboxes are checked? I have a list of checkboxes on a form, and I need to have users select their first and second choices (but no more). So, given this: <input name="checkbox1" type="checkbox" value="a1"> Option 1 <input name="checkbox1" type="checkbox" value="a2"> Option 2 <input ...

XML Javascript parse problem (specific code question )

Hi, I'm using the following parser to parse xml function parseXML(text) { var doc; if(window.DOMParser) { var parser = new DOMParser(); doc = parser.parseFromString(text, "text/xml"); } else if(window.ActiveXObject) { doc = new ActiveXObject("Microsoft.XMLDOM"); doc.async = "false"; ...

jquery - find Nth word in paragraph, add an anchor, then hide remaining text..

Hi I need a way to force a "read more" type effect using jquery. I suspect it will be rather difficult going about it this way but here we go. Take this paragraph: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque interdum nisi ut sapien tincidunt pretium. Maecenas vel mi eu dui feugiat hendrerit. In hac habitasse...

what is jquery and xquery

what is the best place to learn these ...

Jquery: several comparations inside an if, any way to write it shorter?

Hi, have this line: if($('#address_nations_id').val() != 105 && $('#address_nations_id').val() != 74) Is there any way to make it shorter? I tried this: if($('#address_nations_id').val() != 105 && != 74) But it doesnt work. Any idea? Regards Javier ...

Odd jQuery problem - Ajax request to a C program not quite working.

I have this basic setup: C program opens a socket on a specific unused port (let's say 1234) and waits, listening specifically for HTTP requests. Webpage on the same machine, written primarily in CGI, uses jQuery to make an AJAX request targeted at localhost:1234. What I'd like is for the C program to see the request, take some data ...

Opening jQuery UI dialog with a keyboard shortcut puts the key pressed into the dialog's form

I have a form inside a jQuery UI dialog. The dialog is set to open whenever the "t" key is pressed. The problem is, when this happens, the letter "t" gets inserted into the first input of that dialog's form, which I don't want to happen. Here's the code I have: $('#addtime-form').dialog({ minWidth: 351, modal: true, autoOpen: fal...

when inside ready(), can I add functions?

When creating functions for re-use, is it possible to create a function inside the: $(document).ready(function () { }); block of code? ...

jquery slider for html markups

There are tons of jquery sliders for images. However I have some html markups like <p>JavaScript rocks</p> <p>jQuery rocks</p> <p>stackoverflow rocks</p> Assume each <p> is of size 400x400. I want a jquery slider which can slide each p element one by one. ...

if there is already an 'onchange' event on a dropdown, if I bind another, when will it fire?

There is an 'onchange' event, using inline javascript on a dropdown list which I have no control over. In the onready event, if I bind another onchange event, which one will fire first? And will this be a gauranteed order? I want mine to fire AFTER the inline js onchange event. ...

$('#id1').html(" ") removes all children of #id1 from DOM, or they are still there ?

I do something like this: $("#id1").html(data); I refill a div with html but when I try to get the html of a child of this refilled div I get an empty string although it has, it's like the old child is still there but without html. Edit: I tried to reproduce my problem, here is the html: (click 2x times on refill and after click open...

jquery plugin extend problem

Hi everyone this is my first post so I hope I am posting to the right place. I am trying to develop a dialog/modal plugin. this is my first plugin and I'm not sure if I have produced it in the correct way. The problem I am having is that the $.extend is not updating the settings object. I've got 2 elements using the plugin. the #dialog...

jquery validation error replacing select list value

Is it possible to replace a select list (that is required) default value with an error message if it isn't changed? EX if you click submit without selecting a value, replacing the default "Please Select" that has no option value with a "Please select an option" message? If so, how? ...

jQuery Connected Sortable Lists, Save to MySQL

Hello, I have a generated list of items (teams, playing in the season). I want to distribute these items to other lists (divisions for the season) and save new lists to MYSQL (order of list doesnt matter). I have to say that divisions may vary depending on the season, so i have divisions also generated from db. I changed #sortable to ....

How to prevent form submission and make jquery ajax call instead

I have an event to capture when the return key is pressed on a form input field, but the ajax call is not fired, instead the from is submitted as a normal http request. $("#addurl").keypress(function(e){ switch(e.keyCode){ case 13: // add url ajax call $("body").html(ajax_load) ...

Jquery detect when user uses SELECT element in form

Hello, I want to be able to detect when the user has selected an option from a SELECT element in a form. I know what to do from there, but not sure about how to achieve the initial detection. <select id="mySelect"> <option>1</option> <option>2</option> <option>3</option> </select> I would like the solution in JQuery if po...

jquery animate problem

Hi, I need to modify this plugin to rotate images without waiting for animation to end. If you visit that link you might notice that animation restarts at the the end of previous animation but i want images back to back so i dont want to wait for end of the first animation to start next one. Any idea how to do that. Relevant code snippet...