Ana içeriğe atla

Kayıtlar

javascript etiketine sahip yayınlar gösteriliyor

Jquery regex selectors

I needed to find some dom elements which have a regex class names in jquery. Jquery is really awesome and people made some precious contributions to it. One of them is James Padolsey's regex selector which is found here . It fit my needs and I used it like this $('a:regex(class,sometext[0-9]*)').each(function(){ grup="'"+$(this).attr('class').split(' ')[0]+"'" ; $(this).colorbox({rel:grup}); }); in binding colorbox to newly inserted items to the page by infinite scroll . All these bold words are names of great jqeury extensions which I have made use of on a page together with another awesome extension masonry . Extensions, extensions,extensions thats the way we build web pages nowadays.

Getting along with JQuery,Validation,Masked Input

JQuery is a nice library with whom I havent played till yesterday. Since yesterday I am struggling with this nice library, actually not solely with it but with validation plugin. That plugin is nice too but when it comes to integrating it with another plugin which you guess Masked Input, I was having problems. Because my form is dinamic and I am adding elements whose names are the as previous ones, I have struggled a lot. But at the end I did what I wanted to do. This jQuery.validator.addMethod("acceptreg", function(value, element, param) {   return value.match(new RegExp("^" + param + "$")); }); small code piece helped me a lot when validating text and phone fields and their integration with Masked Input. I know validation plugin normally does validate against phone but my case was different. I declared such a method as described above and used it inside with tel: { required: true, minlength:11, maxlength:11,acceptreg: "[0-9]{3}-[0-9]{7}" }, I d...