Update value of input inside hidden div
Hi all,
I'm new to Javascript and jQuery, but trying to learn fast. Any pointers are appreciated!
I've got a select box that, when you choose any option besides #5, it changes the value of a related input box from 0 to 1. This works great except when I hide() the div that wraps this input box.
My overall goal is to have the input (and surrounding div) hidden via hide(), and then update this input box when a select is changed. Here is my code:
- $(document).ready(function(){
$("div#edit-qty-56-wrapper").hide();
function enterQty() {
var attrValue = $( "select#edit-attributes-56-1" ).val();
if (attrValue !== '5') {
$("input#edit-qty-56").val('1');
} else {
$("input#edit-qty-56").val('0');
}
}
$("select#edit-attributes-56-1" ).change(enterQty);
enterQty();
});