Blog
- Details
- Written by R. Elizondo
- Category: jQuery
Event handling in jQuery allows you to respond to user interactions with elements on the web page. Below are some examples of event handling using jQuery.
HTML
<!DOCTYPE html>
<html>
<head>
<title>jQuery Event Handling Examples</title>
</head>
<body>
<button id="btnClick">Click Me</button>
<input type="text" id="textInput">
<p>Hover over this paragraph.</p>
<select id="selectOption">
<option value="option1">Option 1</option>
<option value="option2">Option 2</option>
<option value="option3">Option 3</option>
</select>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="/script.js"></script>
</body>
</html>
jQuery (script.js)
- Details
- Written by R. Elizondo
- Category: jQuery
Here are some examples of selecting elements with jQuery.
HTML
<!DOCTYPE html>
<html>
<head>
<title>jQuery Element Selection Examples</title>
</head>
<body>
<h1>Hello, World!</h1>
<p>This is a paragraph.</p>
<ul>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
</ul>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="/script.js"></script>
</body>
</html>
jQuery (script.js)
- Details
- Written by R. Elizondo
- Category: jQuery
Using jQuery's $(document).ready()
function is a way to ensure that your JavaScript code executes only after the HTML document has been fully loaded. It prevents issues where your code tries to access elements before they are available in the DOM.
Here's an example of how to use $(document).ready()
HTML
<!DOCTYPE html>
<html>
<head>
<title>jQuery Document Ready Example</title>
</head>
<body>
<h1>Hello, World!</h1>
<p>This is a simple example demonstrating the use of jQuery's document ready function.</p>
<button id="myButton">Click Me</button>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="/script.js"></script>
</body>
</html>
jQuery (script.js)
- Details
- Written by R. Elizondo
- Category: PHP Software Development
To query a MySQL table with JSON columns from PHP, you can use the PDO (PHP Data Objects) extension, which provides a consistent interface to work with various databases, including MySQL. Here's an example of how to do it:
Assuming you have a MySQL table named my_table with a JSON column named json_data, and you have already established a connection to the database using PDO, you can follow these steps:
Prepare the query:
Construct a SQL query that includes the JSON column and any other conditions you need.
Execute the query:
Execute the prepared statement and fetch the results.
Process the results:
Since the JSON column data will be returned as a JSON-encoded string, you'll need to decode it to work with it as a PHP array or object.
PHP code example:
Read more: How to query MySql table with JSON columns from PHP
Page 2 of 43