Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How do get html attributes value in client script in my ui page?

LittleSoldier
Kilo Explorer

hey, I try to get the value of HTML attributes in client script onfind_real_file.png the UI page that I created...

2 REPLIES 2

Alikutty A
Tera Sage

Hi,

You should setup an id attribute on your HTML tag and then access it using the following syntax.

var attr = document.getElementById("ID").getAttribute("name");

https://www.w3schools.com/jsref/met_element_getattribute.asp

Thanks!

Community Alums
Not applicable

Hi,

please refer below syntax,

<input  type="checkbox" name="Checkbox1" id="check_one" value="$[count++]" onclick="addChecked(this);"> </input>

 

 var res = document.getElementById('check_one').name; // For getting name of that element in client script
 var resvalue = document.getElementById('check_one').value; // For getting value of that element in client script

 

Please mark as correct or helpful.

 

Regards,

Meghnath