How about JQuery's click method?
You can't/shouldn't invoke that code directly. You can fire off the click event, though, which will cause the inline onclick
code to be called.
$("#the_thing").click();
You could probably have managed to execute the code "directly" by converting it to a string and doing evals, but invoking it indirectly with the click event is a lot better imo.
To directly answer your question:
Remove javascript:
from the onclick: it's only meant to be for protocol definitions on hrefs.
To indirectly answer your question:
There's nothing in that page that couldn't be executed without sticking Javascript in the attributes of the HTML. Try:
- Looping through all checkboxes;
- For each checkbox, grab the contents with things like:
$(this).text()
;$(this).val()
; etc. - Set them to checked with:
$(this).attr('checked', 'checked');
found it...
I don't need to select all checkboxes prior to the fire the click event, as the jQuery method click() will literally click the checkbox and if is not checked it will check and vice versa
the SelectAll method will only need to be:
$("#ulworksites li input:checkbox").each(function() {
if ($(this).attr('disabled') == false) {
$(this).click();
}
});
will work for all (check and uncheck) as you can see in this screencast