javascript - Get value of a jquery element? -
var $x = $("input[name='" + linkedmodule + "']"); //var x=document.getelementsbyname(linkedmodule); console.log($x); if ($x !== "" || $x !== "undefined" || $x !== null) { linkedid = $x.val(); linked_module = $x.attr("relatedmodule"); console.log(linkedid); } else { }
i getting undefined in linkedid please me
in above code object ($x) empty check not proper,
below modified code
var $x = $("input[name='" + linkedmodule + "']"); //var x=document.getelementsbyname(linkedmodule); console.log($x); if (!($x === undefined || $x == null || $x.length <= 0)) { linkedid = $x.val(); linked_module = $x.attr("relatedmodule"); console.log("value of element : "+ linkedid); } else { }
Comments
Post a Comment