Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
12
rated 0 times [  15] [ 3]  / answers: 1 / hits: 21384  / 10 Years ago, tue, october 28, 2014, 12:00:00

Hello I am really struggling with styling the add button inside of this code



I am just learning javascript , so it is kinda confusing on which to call for the css class.



Check out the js fiddle.



http://jsfiddle.net/infinityswift19/6xwyc6tn/



Attemping to style this line >>



 <input type=button value=Add onclick=addItem(document.getElementById('ch1').rowIndex) />


Thanks for any response.


More From » html

 Answers
8

I would suggest adding a class to the button and styling it that way.



<input class=my-button type=button value=Add onclick=addItem(document.getElementById('ch1').rowIndex) />


Then in CSS:



.my-button {
any styles you want go here
}


You should come up with a more meaningful class name than my-button, but you get the idea. This is nice because you can reuse that class later if you need to. For example, if you have a link that also needs to look the same as this button, you can do something like:



<a href=http://wwww.google.com class=my-button>Google Button</a>


Edit: JSFiddle with class added to first button: http://jsfiddle.net/ypLqjmwa/


[#68984] Sunday, October 26, 2014, 10 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
irvingcarloe

Total Points: 677
Total Questions: 109
Total Answers: 96

Location: Svalbard and Jan Mayen
Member since Sun, Sep 25, 2022
2 Years ago
irvingcarloe questions
Wed, Mar 31, 21, 00:00, 3 Years ago
Tue, Aug 4, 20, 00:00, 4 Years ago
Fri, Jul 3, 20, 00:00, 4 Years ago
;