Jump to content
UBot Underground

Problem With Checkboxes In Ui Html Panel


Recommended Posts

I want to check / uncheck child checkboxes when the parent checkbox is checked / unchecked. I have the html and javascript worked out and it works fine in a browser and in ubot. However it stops working in ubot when the variable and fillwith parameters are added to the <input> tag. Is this a bug? If not, what change do I need to make to get this to function as intended? Code is below as well as a sample bot is attached.

 

Thanks in advance

ui html panel("<!DOCTYPE html>
<html>
<head>
<title> How to select all child checkboxes using jQuery </title>

</head>
<body>
<ul>
<li><input type=\"checkbox\" variable=\"#With Variable\" fillwith=\"checked\" /> With Variable
<ul>
<li> <input type=\"checkbox\" variable=\"#This Not Work\" fillwith=\"checked\" /> This Does Not Work </li>
</ul>
</li>
<li> <input type=\'checkbox\' />Without Variable
<ul>
<li> <input type=\'checkbox\' /> These</li>
<li> 
<input type=\'checkbox\' /> Children
<ul>
<li> <input type=\'checkbox\' /> Are All </li>
<li> <input type=\'checkbox\' /> Working </li>
<li> <input type=\'checkbox\' /> Properly </li>
</ul>
</li>
</ul>
</li>
</ul>
</body>
<script src=\"http://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js\"></script>
<script>
// jQuery Code starts from here

$(function () \{
$(\"input[type=\'checkbox\']\").click(function () \{
$(this).siblings(\'ul\')
.find(\"input[type=\'checkbox\']\")
.prop(\'checked\', this.checked);
\});
\});

</script>
</html>
",300)

CheckboxTest.ubot

Edited by nkjackson
Link to post
Share on other sites

Hey nkjackson, 

 

I had a similar problem to this a few months back with glitchy or just not working checkboxes, .. 

The fix for me was simply moving the javascript to a different location (after hous of checking, double and triple chcking lol).

 

Try moving the code between the <script> tags to above the </body> tag, .. if that doesnt work try placing it in and/or below the <header> tags, you should find a sweet spot.

 

 

 

Cheers

CJ

  • Like 1
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...