TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Guest User
Tech Writer
18
2.9k
Change colour using for loop.
Mar 23 2021 12:14 PM
Sir this is my static data with html with different different section
<div
class
=
"topclr"
> --
this
section show orange colour
<h2> Basic</h2>
<h3> Monthly $299</h3>
<p>Annualy $2990</p>
</div>
<ul id=
"oran"
>
@*<i
class
=
"bx bx-check"
style=
"color: #FCA121;"
></i>*@
<li>lorem ipsum</li>
<li>lorem ipsum</li>
<li>lorem ipsum</li>
<li>lorem ipsum</li>
<li>lorem ipsum</li>
<button
class
=
"choose"
type=
"button"
>Choose Plan</button>
</ul>
</div>
</div>
</div>
<div
class
=
"col-md-4"
>
<div
class
=
"back-color"
>
<div
class
=
"plan"
>
<div
class
=
"topclr1"
> --
this
section black colour
<h2> Standard</h2>
<h3> Monthly $399</h3>
<p>Annualy $3990</p>
</div>
<ul id=
"grey"
>
<li>
lorem ipsum
</li>
<li>lorem ipsum</li>
<li>lorem ipsum</li>
<li>lorem ipsum</li>
<li>lorem ipsum</li>
<button
class
=
"choose1"
type=
"button"
>Choose Plan</button>
</ul>
</div>
</div>
</div>
<div
class
=
"col-md-4"
>
<div
class
=
"back-color"
>
<div
class
=
"plan"
>
<div
class
=
"topclr2"
> --
this
section bluee colour
<h2> Premium</h2>
<h3> Monthly $499</h3>
<p>Annualy $4990</p>
</div>
<ul id=
"blue"
>
<li>lorem ipsum</li>
<li>lorem ipsum</li>
<li>lorem ipsum</li>
<li>lorem ipsum</li>
<li>lorem ipsum</li>
<button
class
=
"choose2"
type=
"button"
>Choose Plan</button>
</ul>
</div>
</div>
</div>
</div>
But i have use this code with foreach loop
for
(
var
i = 0; i < response.items.length - 1; i++) {
html +=
'<div class="col-md-4">'
;
html +=
' <div class="back-color" >'
;
html +=
'<div class="plan">'
;
html +=
'<div class="topclr">'
; --bcz here call topclr
class
html +=
'<h2> '
+ response.items[i].name +
'</h2>'
;
html +=
'<h3>'
+ response.items[i].interval + + response.items[i].unitAmount +
'</h3>'
;
html +=
'</div>'
;
html +=
'<ul id="oran">'
;
html +=
' <li></li>'
;
html +=
'<button class="choose" type="button">Choose Plan</button>'
;
html +=
'</ul>'
;
html +=
'</div>'
;
html +=
'</div>'
;
html +=
'</div>'
;
three section display same colour.So i want to display three section with different-2 colour
Reply
Answers (
2
)
jquery DataTable sometimes showing error on load
Selecting Only next child