In my application we have four inputs that are radio controls and on the load the valuefirst radio control is checked to trueby default. When the user selectselects another radio control and then savesaves the form I want to get the new value. I am using the find class but then I need to use checked[0]. Is there a better way to do this?
JS
$("#form").submit(function (event) {
event.preventDefault();
console.log('free-text-form');
var sortOrder = $(this).data('sortorder');
console.log(sortOrder);
var form = $(this);
console.log('Processing Current Check');
var checked = form.find(".radio-Class:checked");
var currentChecked = checked[0];
console.log(currentChecked);
console.log(currentChecked.value);
if (checkedRegRef.length == 1) {
var NewId = currentChecked.value;
console.log(NewId);
}
});
Working Example https://jsfiddle.net/tjmcdevitt/vh9n5srL/87/Here is a Working Example
In my application we have four inputs radio controls and on the load the value is checked to true. When the user select another radio and then save the form I want to get the new value. I am using the find class but then I need to use checked[0]. Is there a better way to do this?
JS
$("#form").submit(function (event) {
event.preventDefault();
console.log('free-text-form');
var sortOrder = $(this).data('sortorder');
console.log(sortOrder);
var form = $(this);
console.log('Processing Current Check');
var checked = form.find(".radio-Class:checked");
var currentChecked = checked[0];
console.log(currentChecked);
console.log(currentChecked.value);
if (checkedRegRef.length == 1) {
var NewId = currentChecked.value;
console.log(NewId);
}
});
Working Example https://jsfiddle.net/tjmcdevitt/vh9n5srL/87/
In my application we have four inputs that are radio controls and the first radio control is checked by default. When the user selects another radio control and then saves the form I want to get the new value. I am using the find class but then I need to use checked[0]. Is there a better way to do this?
JS
$("#form").submit(function (event) {
event.preventDefault();
console.log('free-text-form');
var sortOrder = $(this).data('sortorder');
console.log(sortOrder);
var form = $(this);
console.log('Processing Current Check');
var checked = form.find(".radio-Class:checked");
var currentChecked = checked[0];
console.log(currentChecked);
console.log(currentChecked.value);
if (checkedRegRef.length == 1) {
var NewId = currentChecked.value;
console.log(NewId);
}
});
- 29.5k
- 16
- 45
- 201
In my application we have four inputs radio controls and on the load the value is checked to true. When the user select another radio and then save the form I want to get the new value. I am using the find class but then I need to use checked[0] is. Is there a better way to do this?
JS
$("#form").submit(function (event) {
event.preventDefault();
console.log('free-text-form');
var sortOrder = $(this).data('sortorder');
console.log(sortOrder);
var form = $(this);
console.log('Processing Current Check');
var checked = form.find(".radio-Class:checked");
var currentChecked = checked[0];
console.log(currentChecked);
console.log(currentChecked.value);
if (checkedRegRef.length == 1) {
var NewId = currentChecked.value;
console.log(NewId);
}
});
Working Example https://jsfiddle.net/tjmcdevitt/vh9n5srL/87/
In my application we have four inputs radio controls and on the load the value is checked to true. When the user select another radio and then save the form I want to get the new value. I am using the find class but then I need to use checked[0] is there a better way to do this?
JS
$("#form").submit(function (event) {
event.preventDefault();
console.log('free-text-form');
var sortOrder = $(this).data('sortorder');
console.log(sortOrder);
var form = $(this);
console.log('Processing Current Check');
var checked = form.find(".radio-Class:checked");
var currentChecked = checked[0];
console.log(currentChecked);
console.log(currentChecked.value);
if (checkedRegRef.length == 1) {
var NewId = currentChecked.value;
console.log(NewId);
}
});
Working Example https://jsfiddle.net/tjmcdevitt/vh9n5srL/87/
In my application we have four inputs radio controls and on the load the value is checked to true. When the user select another radio and then save the form I want to get the new value. I am using the find class but then I need to use checked[0]. Is there a better way to do this?
JS
$("#form").submit(function (event) {
event.preventDefault();
console.log('free-text-form');
var sortOrder = $(this).data('sortorder');
console.log(sortOrder);
var form = $(this);
console.log('Processing Current Check');
var checked = form.find(".radio-Class:checked");
var currentChecked = checked[0];
console.log(currentChecked);
console.log(currentChecked.value);
if (checkedRegRef.length == 1) {
var NewId = currentChecked.value;
console.log(NewId);
}
});
Working Example https://jsfiddle.net/tjmcdevitt/vh9n5srL/87/