Color change not happening on first time

Hello!

I made this little code that change color when HTML table tr is clicked.

Here are working example: https://jsfiddle.net/646pzv5q/

The problem:
After clicking HTML table tr modal pops out that shows inside on it some data (dynamic from child.php file).

First time it does not show but every next time it does.

Part of that table is inside that php file that shows in modal.

Main page:

		<table id="ccolor" class="ui small celled sortable table">
			<thead>			
			<tr>
				<th>1</th>
				<th>2</th>
				<th>3</th>
				<th>4</th>
				<th>5</th>

			</tr>
			</thead>
			
			<tbody id="results">		
			</tbody>
				
		</table>

And the rest content is made in child.php
Color changing script is in child.php and if i put it in main file it does not work at all :frowning:

What em i missing?Any help / tip?

I put code for color change in its own <script> tags and now its works!

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.