Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

hiding a link after first click in html.disable link.in html.java

I am passing some values through a link "Like",I want to set the property such that the link is hidden or disabled if it is clicked once.. have tried this code
onclick="this.style.display='none';"

But it does not seems to be working.Please help as where to put the js or any other alternate method..

<a href="like1?sellerid=<s:property value="id"/>&property_id=<s:property value="p_id"/>"onclick="hide">Like</a>;'  
like image 430
zeeshan Avatar asked Oct 31 '22 14:10

zeeshan


1 Answers

As it has been said this functions is better to be implemented with javascript. First assign a valid id for the link and follow this:

//create a function for the click like:
$('#buttonId').click(hideButton);

Afterwards, in your javascript code:

function hideButton(){$('#buttonId').css({'visibility':'hidden'})};

Remember to import jquery library and import the .js when your code has been displayed if you does not use a .ready function.

Edit: note that in the way previously exposed you will still get the box where the link was, but it is displayed hidden.

like image 143
Ferran Buireu Avatar answered Nov 04 '22 07:11

Ferran Buireu