Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.
Not a member yet? Click here to register.
Forgot Password?

Code help for "read more botton" in viewpage.php

Asked Modified Viewed 1,500 times
B
bronxi
B
bronxi 10
Version 9.0 www.bronxi.dk
  • Junior Member, joined since
  • Contributed 13 posts on the community forums.
  • Started 3 threads in the forums
  • Started this discussions
asked
Junior Member

Hi, sorry for my bad english.

I need too create a "read more botton" i a custompages.
I treid this code in an custompage, but it dont work
<div>
    <h1>Example text</h1>
    <p >First text goes here.</p><a href="#" onclick="show('example1')"> read more </a>
    <p id="example1" style="display:none; font-weight: bold">Second text goes here</p></div>
   
    <script>
     function show(ele){
         document.getElementById(ele).style.display = 'block';   
    }
    </script>


Can someone plz help me here.
0 replies

3 posts

R
Anonymous User
R
Anonymous User 367
  • Veteran Member, joined since
  • Contributed 939 posts on the community forums.
  • Started 2 threads in the forums
  • Answered 20 questions
answered
Veteran Member

Very simple solution:

<div>
    <h1>Example text</h1>
    <p >First text goes here.</p><a href="#" id="readmore"> read more </a>
    <p id="example1" style="display:none; font-weight: bold">Second text goes here</p></div>
    </div>
    <script>$(function() {
    $("#readmore").click(function(e) {
        e.preventDefault();
        $("#example1").toggle();
    });
    });
    </script>


or use add_to_jquery function

add_to_jquery('$("#readmore").click(function(e) {
        e.preventDefault();
        $("#example1").toggle();
});');
Edited by Anonymous User on 14-05-2017 19:14,
0 replies
B
bronxi
B
bronxi 10
Version 9.0 www.bronxi.dk
  • Junior Member, joined since
  • Contributed 13 posts on the community forums.
  • Started 3 threads in the forums
  • Started this discussions
answered
Junior Member

Hi robinn

This code dont seem to work alone? It dont open second text.
<div>
    <h1>Example text</h1>
    <p >First text goes here.</p><a href="#" id="readmore"> read more </a>
    <p id="example1" style="display:none; font-weight: bold">Second text goes here</p></div>
    </div>
    <script>$(function() {
    $("#readmore").click(function(e) {
        e.preventDefault();
        $("#example1").toggle();
    });
    });
    </script>


What you are writing about "add_to_jquery function"
I dont understand what it is?
0 replies
C
Chan
C
Chan 0
Lead Developer of PHP-Fusion
  • Super Admin, joined since
  • Contributed 3,842 posts on the community forums.
  • Started 232 threads in the forums
  • Answered 6 questions
answered
Super Admin

PHP Execution turn ON @ Security Settings.


add_to_jquery("$("#readmore").bind('click', function(e) {
        e.preventDefault();
        $("#example1").toggle();
    });");
0 replies

Labels

None yet

Statistics

  • Views 0 views
  • Posts 3 posts
  • Votes 0 votes
  • Topic users 3 members

3 participants

C
C
Chan 0
Lead Developer of PHP-Fusion
  • Super Admin, joined since
  • Contributed 3,842 posts on the community forums.
  • Started 232 threads in the forums
  • Answered 6 questions
R
R
Anonymous User 367
  • Veteran Member, joined since
  • Contributed 939 posts on the community forums.
  • Started 2 threads in the forums
  • Answered 20 questions
B
B
bronxi 10
Version 9.0 www.bronxi.dk
  • Junior Member, joined since
  • Contributed 13 posts on the community forums.
  • Started 3 threads in the forums
  • Started this discussions

Notifications

Track thread

You are not receiving notifications from this thread.

Related Questions

Not yet