Sep
28

Simple jquery confirmation link

JavaScript          Trackback

If you want simple confirmation for link (usually for delete link in your applications) here is simple code you can use:

$('.confirm').click(function() {
return confirm("Are you sure?");
});

Everything you have to do after adding this piece of code is to add “confirm” class to link you want confirm before proceeding.


Sep
20

Get the index of the current element, jquery getEq

JavaScript          Trackback

If you want to grab index of some element you can use this function:

$.fn.getEq = function() { return ($(this).parent().children()).index(this); }

You can call it like this:

$("#someelementid").getEq();


top