简体   繁体   中英

<Label> tag alternative for Javascript

I have the following Problem

I get a variable from PHP via:

echo $var

Actually this takes place in:

<a href:"..\test.php?go=<?php echo $var ?>">

And to a page where you can get more info about $var ...

Today i learned about the display attribute from a div, so i can display the info via Ajax direct in my actual page. So, I tried:

<Label id="123" onclick="doJS(<?php echo $var ?>)> Click ME </Label>

But this doesn't work, I cant click the label, just nothing happens.
How can this be solved?

You have a typo in your code.

Replace

<Label id="123" onclick="doJS(<?php echo $var ?>)> Click ME </Label>

By

<Label id="123" onclick="doJS(<?php echo $var ?>)"> Click ME </Label>

因此,您应该尝试:

<label id='123' onclick="doJS(<?=$_GET['go']?>)"> Click ME </label>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM