Return amount to id; add id for error span.
I actually think I want amount to be id rather than a class, now that I figured out the proper selector to find them all. Also, the $("span", input.parent()) was buggy if there were any other span's other than error-related ones in the supporter-form-inputs div. Finally, ditch that <small> stuff and simply place a font-size reduction into the CSS for the form-error-show.
This commit is contained in:
parent
6b9bdb335e
commit
8c3ecd347a
3 changed files with 10 additions and 9 deletions
|
@ -25,6 +25,7 @@
|
||||||
.form-error-show {
|
.form-error-show {
|
||||||
color: red;
|
color: red;
|
||||||
margin-left: 10px;
|
margin-left: 10px;
|
||||||
|
font-size: 75%;
|
||||||
}
|
}
|
||||||
|
|
||||||
input.invalid, textarea.invalid {
|
input.invalid, textarea.invalid {
|
||||||
|
|
|
@ -44,11 +44,11 @@ $(document).ready(function() {
|
||||||
$("#no_shipping").val("0");
|
$("#no_shipping").val("0");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$('.amount').addClass("valid");
|
$('*#amount').addClass("valid");
|
||||||
$('.amount').on('input', function() {
|
$('*#amount').on('input', function() {
|
||||||
var input=$(this);
|
var input=$(this);
|
||||||
var value = input.val();
|
var value = input.val();
|
||||||
var errorElement=$("span", input.parent());
|
var errorElement=$("span#error", input.parent());
|
||||||
var noCommaValue = value;
|
var noCommaValue = value;
|
||||||
noCommaValue = value.replace(/,/g, "");
|
noCommaValue = value.replace(/,/g, "");
|
||||||
var re = /^((\d{1,3}(,?\d{3})*?(\.\d{0,2})?)|\d+(\.\d{0,2})?)$/;
|
var re = /^((\d{1,3}(,?\d{3})*?(\.\d{0,2})?)|\d+(\.\d{0,2})?)$/;
|
||||||
|
|
|
@ -141,9 +141,9 @@ internal policies</a> are published and available for scrutiny.</p>
|
||||||
<input type="hidden" name="item_name" value="Conservancy Supporter, Annual" />
|
<input type="hidden" name="item_name" value="Conservancy Supporter, Annual" />
|
||||||
<input id="no_shipping" type="hidden" name="no_shipping" value="0" />
|
<input id="no_shipping" type="hidden" name="no_shipping" value="0" />
|
||||||
<label for="amount"><strong>Amount:</strong> $</label>
|
<label for="amount"><strong>Amount:</strong> $</label>
|
||||||
<input class="amount" type="text" name="amount" size="7" minimum="120" value="120" />
|
<input id="amount" type="text" name="amount" size="7" minimum="120" value="120" />
|
||||||
<span class="form-error"><small>$120 is a minimum for Conservancy
|
<span id="error" class="form-error">$120 is a minimum for Conservancy
|
||||||
Supporters. <a href="/donate">Donate smaller amounts here</a>.</small></span><br/>
|
Supporters. <a href="/donate">Donate smaller amounts here</a>.</span><br/>
|
||||||
|
|
||||||
<label for="wantGift"><strong>Do you want to receive a t-shirt? </strong></label>
|
<label for="wantGift"><strong>Do you want to receive a t-shirt? </strong></label>
|
||||||
<input type="hidden" name="on1" value="wantGift" />
|
<input type="hidden" name="on1" value="wantGift" />
|
||||||
|
@ -208,9 +208,9 @@ internal policies</a> are published and available for scrutiny.</p>
|
||||||
<input type="hidden" name="srt" value="0" />
|
<input type="hidden" name="srt" value="0" />
|
||||||
<input type="hidden" name="item_name" value="Conservancy Supporter, Monthly" />
|
<input type="hidden" name="item_name" value="Conservancy Supporter, Monthly" />
|
||||||
<label for="amount"><strong>Monthly Amount:</strong> $</label>
|
<label for="amount"><strong>Monthly Amount:</strong> $</label>
|
||||||
<input class="amount" type="text" name="a3" size="5" minimum="10" value="10" />
|
<input id="amount" type="text" name="a3" size="5" minimum="10" value="10" />
|
||||||
<span class="form-error"><small>$10/month is a minimum for Conservancy
|
<span id="error" class="form-error">$10/month is a minimum for Conservancy
|
||||||
Supporters. <a href="/donate">Donate smaller amounts here</a>.</small></span><br/>
|
Supporters. <a href="/donate">Donate smaller amounts here</a>.</span><br/>
|
||||||
<label for="wantGift"><strong>Do you want to receive a t-shirt? </strong></label>
|
<label for="wantGift"><strong>Do you want to receive a t-shirt? </strong></label>
|
||||||
<input type="hidden" name="on1" value="wantGift" />
|
<input type="hidden" name="on1" value="wantGift" />
|
||||||
<input type="radio" name="os1" value="Yes" />Yes
|
<input type="radio" name="os1" value="Yes" />Yes
|
||||||
|
|
Loading…
Reference in a new issue