How do I indent a side menu using javascript

How do I indent a side menu as shown in the url's of, I am fetching information from a db, using the code

<select size="30" id = "cats" ONCHANGE="location = this.options[this.selectedIndex].value;">
<option value="0" disabled="disabled" >Fundi Category</option>
$i = 0;
foreach ( $category as $categories):

<option value="<?php echo $categories->id; ?>" id= "category" ><?php echo $categories->name; ?></option>

foreach($subcategory as $subcategories):
if($subcategories->category_id == $categories->id):
<option value="index.php?option=com_category&view=components&cartId=<?php echo $subcategories->id; ?>" id="subcategories" onload="Hide()"><?php echo $subcategories->name; ?></option>

1 answer

1 accepted

Well you can use CSS instead of Java Script, either way is your choice.

If you want to use Java Script, You may create a function for it and call this function on the tags related to the menu.

A good method you can use is splice(). Here you have a complete example of that:

Although if you decide to use CSS the text-indent can do the job:

Hope it helps!

Suggest an answer

Log in or Join to answer
Community showcase
Alexey Matveev
Published Saturday in Jira

How to run Jira in a docker container

Everything below is tested on Ubuntu 17.10. I prefer to use Jira in a docker container because: 1. I can install Jira with a couple of commands. 2. I can start and stop Jira just by starting and s...

69 views 1 4
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot