0

Is there a way of making one click do two things? Ideally i'd like a click on an icon to play an audio file and go to a document library... is that possible?

0

Why not.. write both the event under click action.

0

Yes You can perform two different events on click..You can write the both events under single on click bind or in case if you pushing second event later you can bind them differently.

Case 1 : Binding both events with single binding

$("#Icon-ID").on('click', function() {
//do something to play audio file

//Open document library in modal pop up. Since redirection would stop audio file.
SP.UI.ModalDialog.showModalDialog({
    url: document_library_url,
    width: 500,
    height: 500,
    title: "Title of the Dialog"
});
});

Case 2 : Binding both events in separate bindings

$("#Icon-ID").on('click', function() {
//do something to play audio file
});
$("#Icon-ID").on('click', function() {
//Open document library in modal pop up. Since redirection would stop audio file.
SP.UI.ModalDialog.showModalDialog({
    url: document_library_url,
    width: 500,
    height: 500,
    title: "Title of the Dialog"
});
});
  • Fabulous. Now I just have to work out how to apply that code :-) I'm still at the applying everything through CEWP stage of Sharepoint – Hydrogen Nov 16 '17 at 8:12
-1

Write a code under click event of controller.

$("#controllerId").click(function(){

    alert("play an audio file");

    window.location.href = "http:DocumentUrl";
}); 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.