how to define variable in jquery

后端 未结 8 1255
梦谈多话
梦谈多话 2021-01-31 09:09

I would like to know how to declare a variable in jQuery

The code I am currently using is

$.name = \'anirudha\';
alert($.name);

That co

相关标签:
8条回答
  • 2021-01-31 09:37

    You can also use text() to set or get the text content of selected elements

    var text1 = $("#idName").text();
    
    0 讨论(0)
  • 2021-01-31 09:39

    Try this :

    var name = $("#txtname").val();
    alert(name);
    
    0 讨论(0)
提交回复
热议问题