Skip to main content
Code Review

Return to Question

update wording
Source Link

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);
 } 
});

Here is a Working Example

separate sentences with punctuation and capitalization
Source Link

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/

Notice removed Draw attention by Community Bot
Bounty Ended with htmn's answer chosen by Community Bot
edited tags
Link
Notice added Draw attention by Jefferson
Bounty Started worth 50 reputation by Jefferson
edited body
Source Link
Jefferson
  • 413
  • 5
  • 14
Loading
edited body
Source Link
Jefferson
  • 413
  • 5
  • 14
Loading
Source Link
Jefferson
  • 413
  • 5
  • 14
Loading
default

AltStyle によって変換されたページ (->オリジナル) /