Have a look of below example, that will show you , you have two p tag but you want to add div before “htmlbefore” class:

    <!DOCTYPE html>  
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>  
            $("p.htmlbefore").before("<div>Hello india</div>");  
    <button>Insert content</button>  
    <p>This is a tutorial website.</p>  
    <p class="htmlbefore">This is a training institute.</p>  
Please login or Register to submit your answer
Not the answer you are looking for? Browse other questions tagged or ask your own question.