BullGuard Antivirus Sale - 60% Off with openElement !
Forum Home Forum Home >

openElement

> Scripts for Your Website
  New Posts New Posts RSS Feed - Checkbox element
  FAQ FAQ  Forum Search   Register Register  Login Login

Topic ClosedCheckbox element

 Post Reply Post Reply
Author
Message
Yves21 View Drop Down
Newbie
Newbie


Joined: Feb 13 2023
Location: France
Status: Offline
Points: 3
Direct Link To This Post Topic: Checkbox element
    Posted: Feb 13 2023 at 1:33pm
Hello 
I'm tring to use checkbox from thr element panel but impossible to select it by Id

function action() {
var checkBox = document.getElementById("#WEcase");
if (checkBox.checked == true){
    alert("Saved!");
}
nothing when i call the funcion
WEcase is the id of my checkbox element
can you help me telling what is wrong in the code
Thanks
Yves

Back to Top
Hobby001 View Drop Down
Admin Group
Admin Group
Avatar

Joined: Jun 05 2018
Location: Canada, Québec
Status: Offline
Points: 6208
Direct Link To This Post Posted: Feb 14 2023 at 1:27pm
Good question, thanks.

openElement use to embed elements within a div and give this div the ID

<div id="WEcase" class="BaseDiv RNone OEWECheckBoxV2 OESK_WECheckBox2_Default" style="z-index:1">
<div class="OESZ OESZ_DivContent OESZG_WEcase ">
<input type="checkbox" class="OESZ OESZ_CheckBox OESZG_WEcase  OEDynTag0" name="WEcase " value="" />
</div>
</div>

Therefore you have to add the child element input in the element selector $("#WEcase").

Here is some jQuery code to use:

function action(){
if($("#WEcase input").prop("checked")){
alert ("saved");
}
}

$("#WEcase").click(function(){
action();
});
Back to Top
Yves21 View Drop Down
Newbie
Newbie


Joined: Feb 13 2023
Location: France
Status: Offline
Points: 3
Direct Link To This Post Posted: Feb 14 2023 at 9:21pm
Many thanks, it worksBig smile
Back to Top
Hobby001 View Drop Down
Admin Group
Admin Group
Avatar

Joined: Jun 05 2018
Location: Canada, Québec
Status: Offline
Points: 6208
Direct Link To This Post Posted: Feb 15 2023 at 6:13pm
You're welcome, that's the purpose of this Forum
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.063 seconds.