Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple jqScribble and save function don't work properly #2

Open
okwei opened this issue Aug 8, 2013 · 2 comments
Open

Multiple jqScribble and save function don't work properly #2

okwei opened this issue Aug 8, 2013 · 2 comments

Comments

@okwei
Copy link

okwei commented Aug 8, 2013

function saveB() will be called twice in the following code. saveA is not called at all.

<body>

<div id="a"></div>
<div id="b"></div>

<button id="test">test</button>
</body>

<script>
    function saveA(){
        alert('saveA');
    }
    function saveB(){
        alert('saveB');
    }    
    $('#a').jqScribble({
        width: 640,
        height: 200,
        saveFunction: saveA
    });
    $('#b').jqScribble({
        width: 640,
        height: 200,
        saveFunction: saveB
    });

    $('#test').on('click', function(){
        $('#a').data('jqScribble').save(); 
        $('#b').data('jqScribble').save();
    });   
@jimdoescode
Copy link
Owner

I'll investigate this and let you know what I find.

@jimdoescode
Copy link
Owner

I apologize for the delay on getting this fixed. One possible work around is to pass your save method in as a closure:

$('#test').on('click', function(){
    $('#a').data('jqScribble').save(function()
    {
        alert('saveA');
    }); 
    $('#b').data('jqScribble').save(function()
    {
        alert('saveB');
    }); 
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants