Skip to content

Try suggestions for Javascript #11

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

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft

Try suggestions for Javascript #11

wants to merge 1 commit into from

Conversation

Gustry
Copy link
Member

@Gustry Gustry commented Jan 18, 2024

Related to ticket #10

The code was already working before.

$('#toggleLight').click(function(){
// LWC ≤ 3.6
$('#layer-lampadaires button.checkbox[value="lampadaires"]').click();
// LWC ≥ 3.7
$('#node-lampadaires').click();
checkbox.checked = !checkbox.checked;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
checkbox.checked = !checkbox.checked;
if(checkbox){
checkbox.checked = !checkbox.checked;
}

@@ -24,7 +27,7 @@ lizMap.events.on({
// LWC ≤ 3.6
btnText = 'Switch the lights off !';
}
if( $('#node-lampadaires').hasClass('checked') ) {
if( checkbox.checked ) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if( checkbox.checked ) {
if( checkbox?.checked ) {

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

Successfully merging this pull request may close these issues.

2 participants