click on checkbox

what is the easiest way to click on the first check box using a script on the attached web page
see attached
Slide1.JPG
rjefAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

lenamtlCommented:
Hi,

on click of a button
$(document).ready(function(){
  $('#add').click(function(){
  	 $('#vehicle').prop( 'checked', true )
  });
});

Open in new window


see a working example
https://codepen.io/lenamtl/pen/QJyNLa
Julian HansenCommented:
When you say click are you asking

a) How to click that checkbox with script
or
b) When that box is clicked how to check all the other checkboxes?

If you want to target the checkbox in the first row then

$('.table-class tr:first-child td.column-id :checkbox').prop({'checked': true});

Open in new window


Working sample here
rjefAuthor Commented:
so how would I run this exactly
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

lenamtlCommented:
On page load you can determine if a checkbox is checked by simply adding checked to the input
 
<input type="checkbox" name="vehicle" value="Car"   checked   > 

Open in new window


If you want the checkbox to be check only when an action is done then you need to use javascript to add the checked to the input
in my example the user need to click on a button then the checkbox that have the specific ID is selected.

The trigger is the click of a button , this could be anything like click on a table row, a tab ...  
I have update the example so one of the input is checked on page load
https://codepen.io/lenamtl/pen/QJyNLa
Julian HansenCommented:
so how would I run this exactly
Did you see the sample I posted
http://www.marcorpsa.com/ee/t3439.html

It is a fully working example with source code.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
rjefAuthor Commented:
thanks I realized that after I asked.  I am trying to use a webbrowser control in vb6 to do it.  I final got this to work with your help

WebBrowser1.Navigate2 ("javascript:document.querySelectorAll(""input"")[3].click();")
rjefAuthor Commented:
if it is not to much trouble how would I gotten the 2nd checkbox selected?
Julian HansenCommented:
$('.table-class tr:eq(1) td.column-id :checkbox').prop({'checked': true});

Open in new window

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
HTML

From novice to tech pro — start learning today.