Solved

check value in Javascript

Posted on 2014-10-30
2
179 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 51

Accepted Solution

by:
Julian Hansen earned 500 total points
Comment Utility
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This article discusses how to create an extensible mechanism for linked drop downs.
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…

743 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now