Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to pass string in onclick function html

I tried with old question, there they passing the value in js to js.But I would like to pass string from html to javascript. but it gives

Uncaught reference error

my html is

<a href="#" onclick="test(TEST123)">

and my javascript is,

function test(p){
   alert(p)
}

how can I pass the string>


1 Answers

<a href="#" onclick="test('TEST123')">

just wite string parameter in your js function

like image 103
mr. pc_coder Avatar answered Mar 07 '26 23:03

mr. pc_coder



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!