Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8132525
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T09:22:20+00:00 2026-06-06T09:22:20+00:00

I have structure like this. <ul class=gallerylist> <li> <image …> <input …> </li> <li>

  • 0

I have structure like this.

<ul class="gallerylist">
<li>
    <image ...>
    <input ...>
</li>
<li>
    <image ...>
    <input ...>
</li>
<li>
    <image ...>
    <input ...>
</li>
<p style="clear:both;">&nbsp;</p>
</ul>

because of visual correction i have to use <p style="clear:both;">&nbsp;</p> part and i’am adding new list items dynamically via JQuery by:

$('ul.gallerylist').append('<li><img .../><br/><input .../></li>');

but as you can guess it is appended after the <p style="clear:both;">&nbsp;</p> part and it corrupts the visual correction.

My question is : Which way is true to add li inside ul as last but before p tag?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T09:22:21+00:00Added an answer on June 6, 2026 at 9:22 am

    Note

    I think your HTML markup is not valid, can’t place p within ul like you’ve done. Better would be wrap the p within another li and use CSS to accomplish you job.

    For example:

    HTML

    <ul class="gallerylist">
        <li>
            <img src="">
            <input type="text">
        </li>
        <li>
            <img src="">
            <input type="text">
        </li>
        <li>
            <img src="">
            <input type="text">
        </li>
        <!-- wrap within li and assign a class to that li-->
        <li class="makeclear">
                <p>&nbsp;</p>
        </li>
    </ul>
    

    CSS

    /* apply css to that li*/
    .makeclear{
        clear:both;
    }
    

    jQuery

    $('ul.gallerylist li.makeclear')
             .before('<li><img src=""/><br/><input type="text"/></li>');
    

    DEMO

    Read about .before(), it will insert an element before the matched element by selector.

    OR

    $('<li><img src=""/><br/><input type="text"/></li>')
                       .insertBefore('ul.gallerylist li.makeclear');
    

    DEMO

    Read about jQuery .insertBefore()

    But, valid markup is necessary otherwise IE will make you mad. Comments below can give you some clues.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a table structure like this: <table> <tr> <td> <ul> <li class=check></li> </ul>
I have a hierarchical structure like this: class Node { Node Parent; string Name;
I would like to have a structure like this: Mapping class int ID {get;set;}
i have a data structure like this public class Employee { public string Name
i have structure like this <table><tr><td></td><td><input type=button name=button></td></tr></table> <script> $('tr').click(function(){window.alert('tr');}) $(':input').click(function(){window.alert('input');}) </script> when i
I have an Class structure like this: class A { Dictionary<UInt64, B> listB; method1(){}
I have a class structure that looks like this: class Person { public virtual
Assuming I have a simple structure that looks like this: public class Range {
I have a html structure like this : <div id=nav_holder style=position:absolute;border-radius:400px;width:0px;height:0px;background-color:#460203;z-index:350px;> <div id=inner_wrap> </div>
let's say I have an HTML structure like this: <div class=first> <div class=sub-1> <div

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.