Exceedinglife's Profile User Rating: -----

Reputation: 0 Apprentice
Group:
Members
Active Posts:
23 (0.07 per day)
Joined:
01-July 12
Profile Views:
193
Last Active:
User is offline Feb 20 2013 03:54 PM
Currently:
Offline

Previous Fields

Country:
US
OS Preference:
Windows
Favorite Browser:
FireFox
Favorite Processor:
Intel
Favorite Gaming Platform:
PC
Your Car:
Subaru
Dream Kudos:
0
Icon   Exceedinglife has not set their status

Posts I've Made

  1. In Topic: Code works only when refreshed?

    Posted 5 Feb 2013

    View Postandrewsw, on 05 February 2013 - 04:42 PM, said:

    You shouldn't need .trigger() just .click().

    http://api.jquery.com/click/

    so the code i have that is copying the other clear click event when i dblclick is right? then i have one last question. I need to use the "this" keyword so i dblclick on a textbox and it clears only that one text box and not all of them and i need to be able to do this with all 3 boxes
  2. In Topic: Code works only when refreshed?

    Posted 5 Feb 2013

    View Postandrewsw, on 05 February 2013 - 04:15 PM, said:

    It's something like this in the CSS (I haven't tested this):

    input[type='text'].valid:after {
        content: '';
    }
    
    input[type='text'].invalid:after {
        content: '*';
    }
    

    Added: Give all your text-inputs the initial class-name of 'valid'.

    Then, in your jQuery, you would switch the class-name between 'valid' and 'invalid'. Assuming you were looping through and checking each text-input:

    if (isValid) {
        $(this).removeClass("invalid").addClass("valid");
    } else {
        $(this).addClass("invalid").removeClass("valid");
    }
    


    but perhaps you are a few steps away from this yet - you need to loop through the collection of inputs, checking each one.

    css-tricks

    The pseudo-element doesn't work in IE7 I believe, but it just means that it wouldn't show the asterisk in that (old) browser.

    i believe that is till to advanced for me lol but thanks! I do have another question tho about what i am doing
    I need to make a dblclick() so when i double click any text box it will clear all the info like my clear click. i was going to copy and paste the clear code but it says to do this by trigger the click event
    im guessing that is the trigger()? And does trigger just imitate a different event or keep track of events on a page
    this is my code that i made.
    $(document).ready(function() {
    	$("#join_list").click(
    		function() {
    			var emailAddress1 = $("#email_address1").val();
    			var emailAddress2 = $("#email_address2").val();
    			var isValid = true;
    			
    			// validate the first email address
    			if (emailAddress1 == "") { 
    				$("#email_address1_error").text("This field is required.");
    				isValid = false;
    			} else {
    				$("#email_address1_error").text("");
    			} 
    			
    			// validate the second email address
    			if (emailAddress2 == "") { 
    				$("#email_address2_error").text("This field is required.");
    				isValid = false; 
    			} else if (emailAddress1 !== emailAddress2) { 
    				$("#email_address2_error").text("This entry must equal first entry.");
    				isValid = false;
    			} else {
    				$("#email_address2_error").text("");
    			}
    			
    			// validate the first name entry  
    			if ($("#first_name").val() == "") {
    				$("#first_name_error").text("This field is required.");
    				isValid = false;
    			} 
    			else {
    				$("#first_name_error").text("");
    			}
    			
    			// submit the form if all entries are valid
    			if (isValid) {
    				$("#email_form").submit(); 
    			}
    		}//end function
    	);	// end click
    			$("#clear_entries").click(function() {
    				$("input[type=text]").val("");
    				$("input[type=text]").after("*");
    				$("#email_address1").focus();
    				})
    			
    			
    			$("input[type=text]").dblclick(function() {$("input[type=text]").val("");
    			$("input[type=text]").after("*");
    			$("#email_address1").focus();
    			})
    
    
    	$("#email_address1").focus();
    }); // end ready
    
    


    how do i add trigger in that?
  3. In Topic: Code works only when refreshed?

    Posted 5 Feb 2013

    View Postandrewsw, on 05 February 2013 - 03:41 PM, said:

    The problem is caused by the click event for the #clear_entries button being attached within the click event for #join_list.

    It is possible to get this to work, but why not just move it outside this other event - like this:

    	);	// end click
        
        $("#clear_entries").click(function () {
            $("input[type=text]").val("");
    		$("input[type=text]").after("*");
    		$("#email_address1").focus();
        });
    	$("#email_address1").focus();
    

    You end up with lots of stars though! Better would be to use CSS and switch classNames, one of which classes could perhaps use the :after pseudo-element to show the star.

    Thank you i had no idea about my functions trying to combine each other lol and about pseudo-element i am not sure how to use this this is my first program i have ever made with jQuery so i am not to familiar on how to do that yet would you by chance be able to explain how to do that a little better and i will try it?
  4. In Topic: Code works only when refreshed?

    Posted 5 Feb 2013

    View PostMartyr2, on 05 February 2013 - 03:39 PM, said:

    Well I noticed that your code for clicking the clear button is actually in the function for clicking the join list button. I don't think you want that there. The two events are separate.

    So you want take the code...

    $("#clear_entries").click(function() {
       $("input[type=text]").val("");
       $("input[type=text]").after("*");
       $("#email_address1").focus();
    });
    
    


    ... out from inside the curly braces of the $("#join_list").click() function and put it right after line 48 in your code there (the end of the click function). The ready function should setup both click functions for join_list and for clear_entries buttons.

    I hope you understand. :)/>



    thank you very much i did not see that i will try that right away i have been messing with this for like 30 mins and was not able to figure it out lol
  5. In Topic: Adding a check digit to a ID number

    Posted 9 Oct 2012

    I was giving these instructions and i would like someone to clarify on what im suppose to do. I dont know how to make the method:
    if i'm entering a number 45225

    then i need it to add:

    4+5+2+2+5 = 16

    i need a method that can do this to any number then i have to check if it is divisible by 7

My Information

Member Title:
New D.I.C Head
Age:
22 years old
Birthday:
January 24, 1991
Gender:
Location:
Wisconsin
Full Name:
Andrew
Years Programming:
.2
Programming Languages:
Java
HTML

Contact Information

E-mail:
Click here to e-mail me

Friends

Exceedinglife hasn't added any friends yet.

Comments

Exceedinglife has no profile comments yet. Why not say hello?