When I click on my 'Login' link on my site a div slides down with an Email textfield, a Password textfield, and a Forgot Password link. When I click on Forgot Password the following code takes me to my resetPassword.php page:
$('#reset').click(function(){
window.location = 'resetPassword.php';
});
But when I fill in the Email field and the Password field correctly and hit Submit I want it to redirect to another page as well. But it does not redirect. I know my Email and Password are correct because my alert('here') window pops up. Here's the code:
It's supposed to fire when I click on the 'addChild' button. However, if I'm in a different text field and click the 'addChild' button the first "blur" manager fires. The second "click" manager doesn't fire. So what ends up happening is that any things I have to click on the form (radios, checkboxes, buttons) I must do so twice. Is there a way around this?
I have a site with a form on it. All the input text fields with a class of '.required' get a red border (via addition of class '.emptyField') when one tries to submit the form with an empty input text field via this code:
if(!$(this).val().length) {
$(this).addClass('emptyField');
error = true;
}
Now that's not where the problem lies. I have another field that contains a drop down box. When the user selects an appropriate option a new input text field with an id of '#spouseInput' appears and the following code is added to it (class '.required' is added).
And within function checkData() I have the following code which removes the red border from a required field with the onblur event:
if(event.data.requiredBlur)
{
$('.required').each(function() {
$(this).removeClass('emptyField');
if(!$(this).val().length)
{
$(this).addClass('emptyField');
error = true;
}
});
}
Now this function works on fields with a '.required' class inside the HTML. But when I add the '.required' class via the addClass() method this code doesn't work. I don't understand why.
I have a problem with some code. I'm initializing variable dupError = false. Then in my ajax post function I set dupError = true. But when I try to use it on line 13 it's back to false. I don't know how to fix this.
I'm checking users' input into a form. If they fill an input box incorrectly or leave it black I display a message in a paragraph like so: $('p.error').html('The name field is empty);
Now if they have another error I want the text in the paragraph to be appended instead of erased. So I tried this: $('p.error').append('The name field is empty);
But this way, every time I hit submit the same error messages that haven't been fixed duplicate. I want just the errors which aren't fixed to appear and the others to clear out.
I just started learning jQuery and I'm trying to implement an AJAX call. Now i've been able to do this with JavaScript but can't seem to get it working with jQuery. Basically I have a form where users can sign up. If they put in an email address that's already in the database an error should come up telling them so.
Here's my .PHP file:
<?php
include_once('../mysqli_connect.php');
$email = $_POST['email'];
$query = "SELECT id FROM users WHERE email='$email'";
$result = $mysqli->query($query);
if($result->num_rows == 0)
{
$result->free();
$data['success'] = true;
}
else
{
$result->free();
$data['success'] = false;
$data['message'] = 'This email address has already been registered.';
I'm learning jQuery right now from the "jQuery Novice to Ninja" book. They have an example in there using width() and outerWidth() on div's. But when I inspect what width() and outerWidth() return it turns out to be the same value. Is there a difference between width() and outerWidth() of an element?
On this page, http://www.mikeglaz.com/jquery/ when you hover over the navigation links a blue background appears. I'm using jQuery 1.3.2. But when I switch to jQuery 1.7.1 the functionality vanishes. I don't know why. Here's my code:
I just got a book on jQuery and am messing around with some code. The book is "jQuery Novice to Ninja" from SitePoint. There's an example that's supposed to do something with the navigation bar. I'm guessing it's supposed to add a background color to the navigation item being hovered over and also add left padding. Well here's what happens:
I'm not sure what exactly is supposed to happen but I'm guessing that background color isn't supposed to disappear like it does. Anyway, here's the code the book provides. Maybe someone could tell me what's wrong with it?