Wit Wikky
Wit Wikky

Reputation: 1542

I have multiple jPickers on same page ,how do i open single jPicker dialog at a time?

Using multiple jPickers on same page, my problem is when i'm clicking on all three one by one it keeps open. Is there any event or method in jPicker through i can open single dialog at a time? I have checked on jPicker's site they have same problem all dialogs keeps open.

snippet of js code ,

$(function() {
  $('#id1').jPicker();
});
$(function() {
  $('#id2').jPicker();
});
$(function() {
  $('#id3').jPicker();
});

Upvotes: 2

Views: 268

Answers (1)

Aditya
Aditya

Reputation: 4463

Attach an event handler to an elem such that it closes all the open jPicker dialogs,

The logic is jPicker has containers added to the DOM in the same order as they are initialized using .jPicker() , so we close the dialogs of all other containers except the clicked container .

This seemed to be working on the demo page..

//For #id1 jPicker
  $("span.Image").click(function(){
    $('div.jPicker.Container').not(':eq('+$("span.Image").index($(this))+')').find('table input.Cancel').trigger('click');
 });

Here is the working fiddle

Upvotes: 1

Related Questions