You are viewing limited content. For full access, please sign in.

Discussion

Discussion

Set a form Field value using Javascript

posted on September 1, 2017

I have a field

#q1     CSS class   "countcheck"

I want to set the result of a count being run in my code as the value within this field.

$('.countcheck input').val() = count;

 

Something of that nature where I set the value of count within the field value.

 

0 0
replied on September 6, 2017

Thank you.  I tested Arron's and it did end up working.  I was using it withing the wrong place in my function as well which is why it wasn't working in the first place.

0 0
replied on September 4, 2017

Or if you wanted it backwards where the textbox sets the variable, it would be something like:

$(document).on('change, blur', '.countcheck input', updateCount);

function updateCount() {

     var count = $('.countcheck input).val();

}

 

1 0
replied on September 3, 2017

Hey Chase,

To assign a value use this syntax:  $('.countcheck input').val(count)

Hope that helps.

 

1 0
You are not allowed to follow up in this post.

Sign in to reply to this post.