jquery find class and get the value

前端 未结 5 1114
终归单人心
终归单人心 2020-12-13 12:38

I am trying to get the value of an input text field.

the HTML is:

5条回答
  •  被撕碎了的回忆
    2020-12-13 12:56

    Class selectors are prefixed with a dot. Your .find() is missing that so jQuery thinks you're looking for elements.

    var myVar = $("#start").find('.myClass').val();
    

提交回复
热议问题