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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T02:56:16+00:00 2026-06-18T02:56:16+00:00

I got a collapsible-set with a few collapsible-items. Every collapsible-item shout have a few

  • 0

I got a collapsible-set with a few collapsible-items. Every collapsible-item shout have a few buttons with an onclick event:

    <div id="List" data-role="collapsible-set" data-theme="b" data-content-theme="d">
    <div id='ListItem' data-role='collapsible' data-content-theme='b' data-collapsed='false'>
        <h3>Title
            <div style='float:right;'>
                <input type='button'  data-theme='b' value='Settings' data-mini='true' data-inline='true' data-icon='gear' data-icon-pos='top' onclick='test(43);'/>
                <input type='button' value='Delete' data-theme='b' data-mini='true' data-inline='true' data-icon='delete' onclick='test(45);' class='splitButtonClicked'/>
            </div>
        </h3>
        CONTENT
    </div>
</div>


function test(value){
    alert(value);
    return false;
}

The onclick event should call a function with one or more parameters. The event works well, but after the event the listview item collapse. This should not happen!

How can I interrupt the collapse?

Regards

  • 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-18T02:56:17+00:00Added an answer on June 18, 2026 at 2:56 am

    Inline javascript like onclick=... should not be used with jQuery Mobile. To prevent this problem click event must be bound to the button and prevented from propagation to lover levels.

    Here’s a working jsFiddle example: http://jsfiddle.net/Gajotres/z3hsb/

    Code example:

    $(document).on('pagebeforeshow', '#index', function(){    
        $('#first-button').bind('click', function(e) {       
            alert('First button');       
            e.stopPropagation();
            e.stopImmediatePropagation();          
        });    
        $('#second-button').bind('click', function(e) {    
            alert('Second button');   
            e.stopPropagation();
            e.stopImmediatePropagation();           
        });
    });
    

    If you want to find out more about this topic and more take a look at this ARTICLE, to be more transparent it is my personal blog. Or it can be found HERE. One more thing, in my article I have stated that developers should not use bind/live/delegate to bind an event, but here we MUST use bind because of a way how it works / interacts with data-role="collapsible-set", functions live and on will not work here.

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

Sidebar

Related Questions

I have a main frame and a attached collapsible panel that i got from
Got this error message while trying to load view: The model item passed into
I've got a table and it has rows that are collapsible when clicked on
Got a Jsfiddle where I have a textarea which fills a table cell. But
Got another simple question here that is eluding me. I have 2 classes: namespace
Got a strange thing going on, really don't have a idea how to solve
I've got a website set up with well structured pages, eg. <h1> for the
Ok so this is super basic. I just got done implementing the collapsible panel
Got the following code: $(document).ready(function() { $('a.add-item').click(function() { if ($(this).parent().find('input').attr('value', '0')) { $(this).parent().find('input').attr('value', '1')
I've got a collapsible link which has the unicode arrow on it ►This is

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.