Solved

check value in Javascript

Posted on 2014-10-30
2
194 Views
Last Modified: 2014-11-01
Is this the rigth way of create a function in js? I want to add a condition. If value_1 = 'YES" then check box, if not leave it blank.
function GetNameValue1(value_1) {
  if ((value_1[2].value == "YES")) {
    ASPxCheckBox_l_default.SetChecked(true);
  }
  else {
    ASPxCheckBox_l_default.SetChecked(false);
  }
}

Open in new window

0
Comment
Question by:VBdotnet2005
2 Comments
 
LVL 55

Accepted Solution

by:
Julian Hansen earned 500 total points
ID: 40413783
The function is correct - whether or not it does what you want it to or not depends on where it lives.

Are you asking if the function will do what you want or are you asking if in terms of javascript syntax it is written correctly?

The javascript is correct - subject to the following requirements

The parameter value_1 is an array of objects
The array has an element with a key of 2
The object at value_1[2] has a member called 'value'
ASPxCheckBox_l_default is defined and has a method called SetChecked

If the above requirements are met then the function is correct.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question