jquery

how can i format jquery datepicker as "25-JAN-2009"

i would have thought this was: .datepicker({ dateFormat: 'dd-mmm-yyyy' }); for month, i get some number that i dont understnad where they are coming from: ...

jQuery condition for animation

Hey all, am brand new to javascript and jQuery so this question might seem dumb but i couldnt find any exemple or doc on it. I got this function for a little color animation roll-over and roll-out which works fine: $(".box_nav").hover(function(){ jQuery(this).stop(true, false); $(this).animate({ backgroundColor:...

jQuery: serializing hierarchical structure to Json

Let's say I have a nested unordered list that I would like to serialize to json. What is the best approach to this using jQuery? Here is the solution if anybody needs it: $(document).ready(function() { var root = $('#root'); var jsonObj = {}; jsonObj["root"] = processNode(root); var JSON = $.toJSON(js...

track the value o textbox

Hi i have a textbox that is hidden. And i chenge the value based on clicks inside the page. I want to track somehow the value so when value is 0 to call a ajax. i tried using .change but is not working Does anyone have an idea ...

Security-dangers when using anchors instead of submit-input.

I'm currently working on a site where I use anchors to submit forms with jQuery like this: $("a[title=submit]").click( function(){ $(this).parents("form").submit(); }); }); However I've read that using links this way is bad practice, security-wise. Does anybody know what the issues are? ...

jQuery Facebox delay

I need a very FAST and lightweight jquery based Modal box on my site, I am looking at Facebox http://famspam.com/facebox It is a nice plugin and it seems fast and lightweight but I think I can still strip out some of the features I do not need. For example I do not need it to use regex and find photos, so I have removed that part of...

Adjust jQuery datepicker selected date

I need to adjust a date selected in jQuery's datepicker. For example, whatever user chooses, change to closest weekend. Is there a way to do this? Some validation / filtering support. Or maybe it can be done with a help from some other validation library that will track text in the text box, not the datepicker value? ...

Best way to show an admin message to certain users?

I am building a social network site in PHP/MySQL/jQuery. Once a user is logged into my site, I would like to query the DB and get an admin announcement if one exist. This will be a message box that shows on the page to all users but it will have an X to click on it and not show it ever again until the admin post a new announcement mess...

Submitting forms on enter/return when using anchors as submit-input.

I'm using anchors to submit forms: $("a[title=submit]").click( function(){ $(this).parents("form").submit(); }); It works very well, however I still want the user to be able to submit the form when pressing enter or return. Anyone know how to do this? ...

Setting checkbox input when specific value equals variable in jquery

I am trying to use JQuery to set a checkbox to checked if the input value of the checkbox is equal to some other variable that I have. This is what my code looks like: var test_val = "test"; $('#checkbox[value='+test_val+']').attr('checked', true); This does not seem to be working, thanks for the help ...

Styling select element (jQuery)

I tried some plugins but they all come with their own styling which takes quite some time to get rid of. Is there any plugin with minimal styling (or a really simple way) to apply custom background to select element? I just need something very simple. Thanks ...

Determine Pixel Length of String in Javascript/jQuery?

Is there any way to determine the pixel length of a string in jQuery/JavaScript? ...

Combine datepicker and date.js

Has anyone combined the JQuery Datepicker and Date.JS together in one control. I have found several posts alluding to this but have not found any examples of how it is done. I found this http://marcgrabanski.com/article/datejs-javascript-library but then the trail goes cold. Has there been any movement on this? Any pointers would be u...

How to do a $.get on a remote website ?

I'm trying to load via Ajax the last post of a twitter account. I have the url, which is : http://twitter.com/statuses/user_timeline/myuser.json?count=1 This works : $.get("test.php", function(data){ alert("Data Loaded: " + data); }); This doesn't even make a request if I monitor the console in Firebug : $.get("http://twitter.co...

Build, syntax-check, parse and evaluate a query.

Hi, I am building a query in a textarea with different conditions selected from the html controls. Also users are open to do modification to it. Client side: For the below list of condition: a(1, 3) > 20 b(4, 5) < 90 c(3, 0) = 80 I form a query: a(1, 3) > 20 and b(4, 5) < 90 or c(3, 0) = 80 On the server side this has to be parse...

Click Toggle (jQuery)

$("li").hover( function () { // do x }, function () { // do y }); .. thats for hover, how would I do the same for click toggle, i.e do x on click and y on second click? Manythanks ...

DOM Insertion: Are some tag types faster when inserting into DOM?

Hi, I have a web page that used client side templating to update part of the page based on json obtained via an ajax call. At the moment I'm using an unordered list where inside each Li I have markup to display information about a product. I'm interested to know, are some tags faster when inserting into the DOM than others? That is to...

Checking if the class attribute is empty and then removing it if true with jQuery.

Hi, I want to remove the class attribute from all elements that have an empty class attribute. Eg: `<li class="">One</li>` becomes <li>One</li> I have been messing about for ages trying to work it out! The closest I got was var len = $(".splitcolcontainer ul li[class]").val().length; if (len == 0) { $('.splitcolcontainer u...

Returning false on link click jquery

Hi, I wish to have a link which opens popup when clicked however I wish it to open a page in a new window if the user doesn't have JS enabled. The following doesn't seem to work, <a id="tac-link" target="_blank" href="tac.html">terms and conditions</a> function popUp(URL) { day = new Date(); id = day.getTime(); eval("page" + id +...

jQuery selectors and sIFR

I'm trying to use jQuery 1.3.1's :not selector with sIFR Ver. 3 Rev. 436. I've enabled the use of jQuery selector's as per the instructions at the sIFR Wiki, and basic selector's work which leads me to believe that sIFR is using the jQuery selectors. More advanced jQuery selector's are not, though. To enable jQuery selector's I remove...