How to use jquery selector having element type and ID

前端 未结 2 555
一整个雨季
一整个雨季 2021-02-13 05:00

I\'m using this selector $(\"textarea #myTextArea\").val(text); and it\'s not working. If I remove the ID and use the class it\'s working. Why isn\'t jquery able t

2条回答
  •  醉话见心
    2021-02-13 05:14

    Because of the space. With the space it says the #myTextArea within a textarea.

    $("textarea#myTextArea").val(text);
    

提交回复
热议问题