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 6013455
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T02:33:02+00:00 2026-05-23T02:33:02+00:00

$str = <div>blahblahblah<b>foofoo</b><i>barbar</i></div>; I separate two part 1-presentation_text 2-full content when click on read

  • 0
$str = "<div>blahblahblah<b>foofoo</b><i>barbar</i></div>";

I separate two part

1-presentation_text
2-full content when click on read more.

  $presentation  = substr($str,0,23);
 <div>blahblahblah<b>foo
  $detail = substr($str,23); 
  foo</b><i>barbar</i></div>

How Can I keep the format when it display in presentation block and detail block?
I mean

in presentation block should be:

blahblahblahfoo /* foo have bold here*/

in detail block

foobarbar /* foo have bold too*/

  • 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-05-23T02:33:03+00:00Added an answer on May 23, 2026 at 2:33 am

    Much easier to do it client-side:

    CSS

    .presentation {
        width: 200px;
        height: 20px;
        overflow: hidden;
    }
    .detail {
        width: auto;
        height: auto;
    }
    

    Javascript

    $(function(){
        $('.presentation').live('click', function(){
            $(this).attr('class', 'detail');
        });
    
        $('.detail').live('click', function(){
            $(this).attr('class', 'presentation');
        });
    });
    

    HTML

    <div class="presentation">
        <div>blahblahblah<b>foofoo</b><i>barbar</i></div>
    </div>
    

    Working example: http://jsfiddle.net/fznWf/1/

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

Sidebar

Related Questions

var str = '<div part=1> <div> ... <p class=so>text</p> ... </div> </div><span></span>'; I got
<?php require_once(simple_html_dom.php); $str = '<div class=content><span>text1</span><span>text2</span><span>text3</span><span>text4</span><span>text5</span><span>text6</span><span>text7</span><span>text8</span><span>text9</span><span>text10</span><span>text11</span><span>text12</span><span>text13</span><span>text14</span><span>text15</span><span>text16</span></div>'; $dom = html_entity_decode($str); $html = str_get_html($dom); foreach($html->find('span') as
Here is my jQuery code to append two tables to a DIV. var str
my code is: function htmlEncode (str){ var div = document.createElement(div); div.textContent=str; return div.innerHTML; }
string str = one three; string::iterator it; string add = two ; Lets say
var str = $('.rating').html(); $.trim(str); $('.rating').prepend.attr('class', 'rating-' + str.replace(/\s/g, )); <div class=rating>1</div> <div class=rating>2</div>
I have following code (live: http://jsfiddle.net/xyZY8/1/ ): var str = '<div>hello</div><ul><li>Some text...</li>' + '<li>second
For starters, this is my jsfiddle: http://jsfiddle.net/gab2G/2/ <div id=div>Click</div> <a href=#>Blabla</a> <a href=#>Blabla</a> <a
<script> $(:checkbox).click(function () { var str = ; $(input:checked).each(function () { str += ($(this).val())
I have this code: function render(str) { var main = document.createElement('div'); with(main.style) { //style

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.