Getting an empty value with val()

后端 未结 1 606
攒了一身酷
攒了一身酷 2021-01-24 00:36

I have table with the following id inside one of the rows the

相关标签:
1条回答
  • 2021-01-24 00:47

    Since the <span> isn't an <input> tag (or other form input like <select>), it will not have a .val() (value). Instead, you need either .html() or .text():

    var spanishWord = $("#randomWordToTranslate");
    var inputValue = spanishWord.text();
    // Or:
    var inputValue = spanishWord.html();
    
    0 讨论(0)
提交回复
热议问题