Getting the value of a text or checkbox with jQuery and putting it into a variable
<p>I have the following code:</p>

<pre><code>$("input[id^='Order_'], input[id^='Default_']")
   .change(function (e) {
      var type = $(this).attr('id').split('_')[0];
      updateField('Menu', $(this), type);
});

The input with an id of 'Order_' has a type="text"
The input with an id of 'Default_' has a type="checkbox"
</code></pre>

<p>In my updateField I have a problem:</p>

<pre><code>function updateField(entity, obj, type) {
    var val = obj.val();
    var idArr = obj.attr("id");
    var idTmp = idArr.split("_");
    var id = idTmp[1];
    var pkrk = $("span[id='refKey_" + id + "']").html();
</code></pre>

<p>The problem is that the code works good for the text but not for the checkbox. If the checkbox is checked or not then it still returns true. Is there a way that I can get the value of if the checkbox is checked or not and either put the string "true" or "false" into the variable  val  while still having the correct value put into   val if the date is coming from the Order_ ?</p>

<pre><code>So if the value of Order_ field is 25 then val = "25"
So if the value of Default_ checkbox is true the val = "true"
So if the value of Default_ checkbox is false the val = "false"
</code></pre>
