Sort items by a specific class name

I'm trying to order the div based on the col-md-x. First col-md-4 and then col-md-8. I tried the sort function of jQuery in this variant: var divElement = $('.container').find('.row').sort(sortMe); function sortMe(a, b) { return a.className > b.class

AJAX returning 404 not found

I am trying to get data from my database using ajax call but it returns this error: This is my AJAX call $.ajax({ url : '<?php echo base_url('Create_controller/getCategory'); ?>', dataType : 'json', success: function(data) { $(data).each(function(){

this.value returns the parentheses with the value

Maybe this could be a stupid question, but I'm not an expert of jQuery, so I need some explanation. I want get the value of the selected option in my select. So I write this code: var actual_option = $(this).find('option:selected', this).map(function

Javascript - Highlight red if the date and time have expired

Hi folks im sure this is probably a simple question for alot of you. I have a a text field in a TD with a date "23/04/2015 9:23 PM" and I need that cell to simply to orange when its 30 minutes overdue and red if 60 minutes overdue. I have this f

The return statement runs before the ajax response

I am making an ajax call on submit button click event to check field validations server side. When I get a validation fail, ajax response gives the proper error message, returns false, and stops the form to submit to the action url. But when I get a

jQuery on the hover menu items

On this site we have the main menu. 'On hover' the menu-items i want to change the 'Main-image' in the third column. The owner is using a plugin to built the menu. I am stuck to this structure. But i can give a CSS class name: links1, links2 etc (to

How to set auto as min-height using jQuery for div?

I have following div element which receives min-height at the time of page load. <div id="main_div" style="min-height: 2000px"> </div> But I do have one select box on same page and onChange event of it I am loading other co

Allow download of files deposited in IE?

I have a file upload which works great in everything except IE. When i drag a file or picture to the upload area and drop it that file or picture opens and redirects my site. How do i stop this? The plugin i used is simple and can be found here, they

highlight the current menu problems

I'm not understanding why I'm not able to highlight the current menu page on a navigation bar (except the fact I'm a total beginner :-) I'm using a JQuery function, one among many I've found on the net, none of them working. Function is: <script type

Jquery.validate validation for non-active tabs

I've a form which uses jQuery UI based tab to organize different fields. I'm using jquery.validate.min.js for validation. For example some fields have class = "required" which informs the plugin for required field validation. Finally, before for

Checking a cookie in a PHP script

Hey i still need a little bit of help with the rating system but i have a problem checking if the cookie exist this is <?php $rating = new ratings($_POST['widget_id']); isset($_POST['fetch']) ? $rating->get_ratings() : $rating->vote(); class rati

Magento Go - jQuery only works on the product details page

I added some custom jQuery to the footer static block as documented on Magento Go website: (function($) { alert("lol"); })(jQuery); And this only works on product page. On every other page on the website I get jQuery is not defined [Break On Thi

How to assign a variable using onclick of html?

I am writing a code where the onclick of html should cause a javascript variable to be assigned a value which causes a function to trigger. <script type="text/javascript"> function set_str(numb) { if(numb == 1) var str_in_func = 'a.tab_1';

Do we "declare" jQuery or simply use it?

I was asked in an interview that how do you 'declare' jQuery? He did not mean a jQuery variable or a $(func()). In case you find this question weird, please do not penalize me for this as I'm enquiring just cause I was asked. :)You don't "declare&quo

$ .getJSON function

I want to know what $.getJSON exactly does. Is it used to send a request? OR Is it used as a callback function? Also, please let me know the various scenarios wherein I can use $.getJSON$.getJSON makes an ajax request to the specified url with the sp

jquery: if ul is empty

Okay I have a jQuery dialog box which has a form in it and I am at my wits end trying to figure this out... Lets see if I can verbalize what I am trying to do.. I have 3 text boxes. #apInterest, #apPayment and #apPrincipal in that exact order. basic

How to stop / replace a Jquery TimeOut function?

I have a small jquery snippet that displays notification message at the top of the screen in response to user actions on a page. The notification is often displayed after Ajax actions with dynamic content inside it. For example: $("#mini-txt").h

Adding class to all elements using: eq

I want to add the class 'second-col' to all second TD's in each row, but this isn't working: $('table.tst3 tbody td:eq(1)').addClass('second-col'); use nth-child instead, 'eq' will Reduce the set of matched elements to a single element $('table.tst3