views:

139

answers:

1

Hi

I'm developing a google chrome extension. I am trying to use the jquery-ui datepicker inside a jquery-ui dialog of the existing webpage (content level)

Like so: Screenshot

I get "DP_jQuery_1274168529407 is not defined" when I click on any button of the datepicker widget and I think that it's because jquery datepicker adds on the html:

onclick="DP_jQuery_1274192751418.datepicker._selectDay('#new\\-app\\-date',4,2010, this);return false;"

This means i'll have to change the datepicker library to avoid modifying the html but rather attach an event on each obj like this:

.click(function(){DP_jQuery_1274192751418.datepicker._selectDay('#new\\-app\\-date',4,2010, this);return false;})

This will probably keep the scope safe

What do you think?

A: 

My haxorz skills have once again prevailed!

Modifying code of jquery-ui.js in function _updateDatepicker at line 8307 by inserting:

.find('[onclick]').each(function(){
    var command = $(this).attr('onclick')+'';
    $(this).removeAttr('onclick');
    command = command.replace("function onclick(event) {","");
    command = command.substr(0, command.length-2);
    $(this).click(function(){eval(command);});
})
.end()

Will solve this problem.

I know it's ugly I know it can be done with fewer lines But it's just temporary until the jquery ui team fixes this

KamiMark