Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 170
  • Last Modified:

how to get the keyValue of the value option using jquery?

how to get the keyValue of the value option using jquery?

$("#list").append('<li value=" + keyValue + ">'  + dataValue +'</li>');


I'm trying to use an alert function to get test the values of the keyValues but not working....

alert($("#list li[value]").val());
0
areyouready344
Asked:
areyouready344
1 Solution
 
Gurvinder Pal SinghCommented:
Not sure if list element has any attribute called 'value'

perhaps something like this

$("#list li").each(function(){
  var value = $(this).attr("value");
  if (value!= null && value != undefined)
 {
   alert("for key : " + value + " value is : " + $(this).html());
  }
});

0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now