jquery dynamic id

后端 未结 4 1196
广开言路
广开言路 2021-01-06 08:56

i use such code to access item

function f(id){

$(\"#\"+id).val(); // with analogy $(\"#id item\")
}

is it correct? is any other methods?<

4条回答
  •  梦毁少年i
    2021-01-06 09:35

    You could use PureDom

    function f(id){
       return document.getElementById(id).value;
    }
    

    Take that, jQuery!

提交回复
热议问题