获取输入值并更改div

时间:2017-09-16 20:26:14

标签: javascript jquery

我正在尝试使用输入值更改范围我的代码上的错误是什么。

void promptNames(int numberRelatives, char relative[][256])
    {
       char name[256];
       for (int a = 0; a < numberRelatives; a++)
       {
          cout << "Please enter the name of relative #" << a + 1 << ": ";
          cin  >> relative[a];
       }

       cout << endl;

    }

void promptSequence(int numberRelatives, char relative[][256],
                   char sequence[][9])
{
   string tempString;
   for (int b = 0; b < numberRelatives; b++)
   {
      cout << "Please enter the DNA sequence for ";
      cout << relative[b] << ": ";
      cin  >> tempString;
      for (int c = 0; c <= 9; c++)
      {
         sequence[b][c] = tempString[c];
      }
   }

   for (int k = 0; k <= numberRelatives; k++) //testing what sequence will be
   {
      for (int g = 0; g < 10; g++)
      {
         cout << sequence[k][g];
      }
      cout << endl;
      }

   cout << endl;
}
$(document).ready(function(){
  if ($('#tnx-status').val() = 'publish'){
    $("#status-p").html("Complited")
  }
  	});

1 个答案:

答案 0 :(得分:1)

使用比较运算符===代替赋值运算符=

$(document).ready(function(){
  if ($('#tnx-status').val() === 'publish'){
    $("#status-p").html("Complited")
  }
  	});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<input name="tnxst" type="hidden" id="tnx-status" value="publish" />
<span id="status-p"></span>