I am sending Data like this way But On anchor Hover Its showIng the table name how can i hide the table name and access this name in that function :
<a href='javascript:item(1,'name');'> </a>
$list->table_name This showing the Table name on the hover of anchor how can i hide and access the same name in that Item function.
最佳答案
您可以使用data-*属性。这将在悬停时隐藏它,但它将位于 DOM
上.
<a href='javascript:item(".$list->id.");' data-table-name='\"".$list->table_name."\"'> </a>
输出应如下所示(当 $list->id
= 1 且 $list->table_name
= my_table 时):
<a href='javascript:item("1");' data-table-name='my_table'> </a>
然后您可以使用 JavaScript
访问它Element.getAttribute()
功能。
例如:
var e = document.getElementById('some-id'),
tableName = e.getAttribute('data-table-name');
console.log(tableName); // my_table
<a id="some-id" href='javascript:item("1");' data-table-name='my_table'> </a>
关于javascript - 通过Js发送时如何隐藏名字,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46211185/