Jump to content

echoing a checkbox with js in it


powpow

Recommended Posts

I am having issue creating a checkbox that uses a onClick() js method.  I believe this might be due to the fact that I am echoing the html but if any one could help id appreciate it. 

 

 

echo "<tr><td>WrkComp</td><td><input type='checkbox'" ?>
<script>onClick="show()" </script> 
<? "name='WrkComp[]' value='DEP' '.$checked.' '.$Disabled.'/></td>";

Link to comment
https://forums.phpfreaks.com/topic/227251-echoing-a-checkbox-with-js-in-it/
Share on other sites

I don't see why you are including you onclick in script tags?

 

echo '<tr><td>WrkComp</td><td><input type="checkbox" onclick="show()" name="WrkComp[]" value="DEP" ' . $checked . ' ' . $Disabled . '/></td>';

 

Edit: onclick validates where onClick does not.

Just do the following:

When echoing a onclick() event in your code you dont need to do anything different than what you do when echoing lets say 'name' pr any other attribute name of a tag.

echo "<tr><td>WrkComp</td><td><input type='checkbox' onClick='show()' name='WrkComp[]' value='DEP' '.$checked.' '.$Disabled.'/></td>";

Well some how through my problem solving I skipped step 1.

 

Thank you for your solutions.

 

Edit: onclick validates where onClick does not.

 

Can you supply me a link about onclick? I did a quick "onclick vs onClick" google search and nothing came up.

 

Thanks again!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.