on 09-15-2016 12:50 PM
Hi,
I want to give custom css to sap.m.Button. I had tried below code:
var button = new sap.m.Button({text:"BorderonButton");
$(button.getId()).addClass("rightBorder");
rightBorder is defined in css file like below:
.rightBorder{
border-right:1px solid;
}
But somehow I am not able to add this css to button. Using addStyleClass, I can do it but in some controls, I usually get an error that addStyleClass is not a function. So I want to use above mentioned approach.
Thanks,
Dashrath
Hi Dashrath ,
Try one from below:
using JQuery:
$("#"+button.getId()).addClass("rightBorder");
in Javascript:
document.getElementById(button.getId()).className = "rightBorder";
Multiple class :
document.getElementById(button.getId()).className += " rightBorder";
Regards,
Akhilesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Kalpan,
Yes. We can achieve it using addStyleClass. But i mentioned that i don't want to use addStyleClass. As some control doesn't support this event. For button its fine, but same event can't be used for sap.ui.layout.form.FormContainer. That's why i want to achieve using jQuery.
Thanks,
Dashrath
Hi Dashrath,
We have a option of Nested Selectors. Add a class to page and with this class we can add the style to form
Please see Nested selectors: the inception rule
Ex:
If i want to change h1 background-color in below code
.container .content .articles .post .title he{
background-color : red;
}
following code also will work
.container .title he{
background-color : red;
}
<body>
<div class="container">
<div class="content">
<div class="articles">
<div class="post">
<div class="title">
<h1><a href="#">Hello World</a>
</div>
<div class="content">
<p></p>
<ul>
<li>...</li>
</ul>
</div>
First we need to check in inspect element. then we need to app appropriate class properties
Thanks
Suresh
Hi Dashrath,
Try with
document.getElementById('Button').setAttribute('class','IN-widget')
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.