Skip to main content

Posts

First JQuery project… a little stuck

Last night someone on here really helped me out a lot with my first validation from scratch, i brought it alot further since last night. This is the first time I'm touching JQuery, I apologize for my crumby coding. Here's what I have that works fine and dandy for the validation UP until the last else statement: //VALIDATE FIRST REGISTER PAGE! $('#submit1').live('click', function() { check_value1(); }); function check_value1(){ var firstname = $('#firstname').val(); var lastname = $('#lastname').val(); var email = $('#email').val(); var password = $('#password').val(); var username = $('#username').val(); if(firstname =='' || firstname.length <2) $('#fnameError').fadeIn().fadeOut(5000); else if(lastname =='' || lastname.length <2) $('#lnameError').fadeIn().fadeOut(5000); else if(email =='' || email.length <5) $('#emailError').fadeIn().fadeOut(5000); else if(pass

How do you remove a class that matches a pattern from the class attribute, but retain the other classes?

I want to delete the classes that end with 'blue' from the class attribute on all tags sample html <p class="text_blue happy">this is blue text</p> <p class="text_red nothappy">this is red text</p> <img class="img_blue nothappy" /> This will give me all the elements with classes that end with 'blue' $('[class$=blue]'); how do I pop these matched classnames off of the class attribute?

Set element to Hidden when clicked

I'm putting together this basic script for a site: http://jsfiddle.net/mcgarriers/rVPnu/2/ It works great when I select the various numbers (it shows the relevant divs) but when I go back to click "Select" it still displays the <div> s. I'd like it if the user clicks "Select" that mySpecialElements is hidden again . Can someone show me how to achieve this? Many thanks for any pointers.

Infinite scroll new element

I'm trying to add a voting function to each new element within the Infinite Scroll. I managed to get the voting functions working but this doesn't work with new elements loaded when scrolling down the page. Pastebin URL: http://pastebin.com/0eNYDXrm I've attached my code below. Any help or advice would be appreciated...Many Thanks! <script type="text/javascript"> $('.protected-post-form').center(); $('#content').infinitescroll({ debug: false, loading: {}, state: { currPage: "1" }, nextSelector: "div.navigation a:first", navSelector: "div.navigation", contentSelector: "#content", itemSelector: "#content div.post", pathParse: ["<?php echo $_SERVER["HTTP_HOST "] . $_SERVER["REQUEST_URI "] ?>page/", "/"] }, function() { window.setTimeout(infinite_scroll_callback(), 1); }); function applyvote(elemen

How Can I add This jQuery Twice to the Same Page?

I am trying to add this code, generated by a WordPress plugin, to the same page twice - but it won't generate the countdown timer the second time.... Is there a simple change I could make to make it appear twice? THANKS! <script type="text/javascript"> <!-- jQuery(document).ready(function($){ var austDay = new Date("2012/02/11 00:00"); jQuery.countdown.regional["uji"] = { labels: ["Years", "Months", "Weeks", "Days", "Hours", "Minutes", "Seconds"], labels1: ["Year", "Month", "Week", "Day", "Hour", "Minute", "Second"], compactLabels: ["A", "L", "S", "Z"], whichLabels: null, timeSeparator: ':', isRTL: false }; jQuery.countdown.setDefaults(jQuery.countdown.regional["uji"]); jQuery(&