Click here to Skip to main content
15,886,518 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Hi
I have this button below in my javaScript file

JavaScript
html('<a href="#" ' + (aData["isActive"] ? 'class="btn-action glyphicons ok_2 btn-success"' : 'class="btn-action glyphicons remove_2 btn-danger"') +
                '" id="' + nRow + '"  önclick="this.src = onSaveCampusStatus(' + "'isActive'" + ',this.src,' + aData["campusID"] + ')" ></a>');


when u click this button it should change it css.
Problem is, How do I make this button visible in my html?
Posted
Comments
Sampath Lokuge 28-Sep-13 10:50am    
You're trying to render a hyper link.So, is that render on your view correctly ?
Sergey Alexandrovich Kryukov 28-Sep-13 11:06am    
I don't see any buttons in your code. Where?
—SA
Ganesh KP 28-Sep-13 14:32pm    
I think with the id assigned to this hyperlink, you can set visible to true or false in your html.

1 solution

Note: btn-danger. It's using Bootstrap. Do you know you have to include bootstrap reference in your file?
Tricky stuff with ? ternary operator. If the value of adata["isActive"] is true then it sets up the button to be btn-action class otherwise it's btn-danger.

I agree, set the visibility:visible style on the
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900