javascript - How can hide name when sending through Js -
i sending data way on anchor hover showing table name how can hide table name , access name in function :
<a href='javascript:item(1,'name');'> </a> $list->table_name showing table name on hover of anchor how can hide , access same name in item function.
you can use data-* attribute. hide on hover on dom.
<a href='javascript:item(".$list->id.");' data-table-name='\"".$list->table_name."\"'> </a>
the output should (when $list->id = 1 , $list->table_name = my_table):
<a href='javascript:item("1");' data-table-name='my_table'> </a>
then can access using javascript element.getattribute() function.
ex:
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>
Comments
Post a Comment