I would like a for loop in jquery using `.html()`
like this:

```
.html('<select property="doctype" name="doctype"><%for (String number : list)
{%>'<option value="'<%=number%>'>'<%out.println(number); %>'</option>'<% } %>'</select>');

```

In Java's for each loop list it uses an object of `java.util.ArrayList<String>`. 

Here the `.html();` function will call when we click on add button.
Here my question is it possible to write jsp scriplet code in .html() of jquery.
['https://Stackoverflow.com/questions/17608853', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2147478/']
```
<nav id="nav-single">
    <?php
        $prev_post = get_previous_post(); 
        $id = $prev_post->ID ;
        $permalink = get_permalink( $id );
    ?>
    <?php 
        $next_post = get_next_post();
        $nid = $next_post->ID ;
        $permalink = get_permalink($nid);
    ?>
       <span class="nav-previous"><?php previous_post_link( '%link', __( '<span class="meta-nav">&larr;</span> Previous', 'twentyeleven' ) ); ?> 
            <h2><a href="<?php echo $permalink; ?>"><?php echo $prev_post->post_title; ?></a></h2>
       </span>

       <span class="nav-next"><?php next_post_link( '%link', __( 'Next <span class="meta-nav">&rarr;</span>', 'twentyeleven' ) ); ?>
            <h2><a href="<?php echo $permalink; ?>"><?php echo $next_post->post_title; ?></a></h2>

      </span>
</nav>

```

![enter image description here](https://i.stack.imgur.com/tmiYx.png)
I hope you are using this code in single.php from where the whole of the post is displayed. For displaying the links (Next/Prev), you need to check the function.

```
get_template_part()

in the same file (Single.php of your theme). In my case function in single.php has been passes parameters like

<?php get_template_part( 'content-single', get_post_format() ); ?>

So, you will open the "content-single.php" according to the parameters specified in the function and paste the same code

<div class="alignleftfp">
<?php next_post('%', '<img class="imgalign" src="' . get_bloginfo('template_directory') . '/images/1.png" alt="Next" /> ', 'no');
?>
</div>

```

```
<?php previous_post('%', '<img class="imgalign" src="' . get_bloginfo('template_directory') . '/images/2.png" alt="Next" />  ', 'no');
?>
</div>

below <h1 class="entry-title"><?php the_title(); ?></h1>

```

I hope this will solve your problem.