How to get the value of an attribute in Javascript

后端 未结 3 747
灰色年华
灰色年华 2020-12-09 19:26

I have this input line which I am trying to extract the text of the value attribute:

    

        
3条回答
  •  误落风尘
    2020-12-09 19:46

    OR with jQuery you can get value from textbox like

    var val1 = $(".class name").val();//to get value by class name
    var val1 = $("#id").val();//to get value by id
    

    Both will do same.

    Regards

提交回复
热议问题