Swapping rows in JQuery

Here’s another solution. To move a row down: jQuery(“#rowid”).next().after(jQuery(“#rowid”)); To move a row up: jQuery(“#rowid”).prev().before(jQuery(“#rowid”));

How to make past date unselectable in fullcalendar?

I have done this in my fullcalendar and it’s working perfectly. you can add this code in your select function. select: function(start, end, allDay) { var check = $.fullCalendar.formatDate(start,’yyyy-MM-dd’); var today = $.fullCalendar.formatDate(new Date(),’yyyy-MM-dd’); if(check < today) { // Previous Day. show message if you want otherwise do nothing. // So it will be unselectable … Read more

How do I assemble a using jQuery append()?

Nope, you can’t use it like that. append is an atomic operation, which creates the element directly. // The <ul> element is added to #details, then it is selected and the jQuery // selection is put in the “list” variable. var list = $(‘<ul/>’).appendTo(‘#details’); for (var i = 0; i < 10; i++) { // … Read more

Toggle between two classes in jQuery

How about $(YOUR_ELEMENT).live(“EVENT_NAME”, function() { $(“.portlet-header”).toggleClass(“ui-icon-plus”).toggleClass(“ui-icon-minus”); }); Even more shorter $(YOUR_ELEMENT).live(“EVENT_NAME”, function() { $(“.portlet-header”).toggleClass(“ui-icon-plus ui-icon-minus”); }); EDIT As of jQuery 1.7, the .live() method is deprecated. Use .on() to attach event handlers. Users of older versions of jQuery should use .delegate() in preference to .live(). jQuery API reference

Bootstrap formvalidation.io trying to require one field or the other

You can disable the second validation and make it enabled only when the first is wrong : take a look at this link <form id=”profileForm” method=”post”> <p>Please provide one of these information:</p> <div class=”form-group”> <label class=”control-label”>Social Security Number</label> <input type=”text” class=”form-control” name=”ssn” /> </div> <div class=”form-group text-center”>&mdash; Or &mdash;</div> <div class=”form-group”> <label class=”control-label”>Driver’s License Number</label> … Read more

jQuery recursive iteration over objects

The .find(‘selector’) method is basically a recusive version of .children(), and will find any descendant object that matched the selector, as opposed to .children() which only finds objects in the first level of descendants. 2nd EDIT (I phrased badly the first time, and messed up the code a bit!): Ok, I don’t think this functionality … Read more

tech