1638804480
append()
ou prepend()
modalVous pouvez ajouter ou insérer des éléments dans le DOM à l'aide de jQuery append()
ou de prepend()
méthodes. append()
La méthode jQuery insère le contenu à la fin des éléments appariés, tandis que prepend()
cette méthode insère le contenu au début des éléments appariés.
L'exemple suivant vous montrera comment ajouter facilement de nouveaux éléments à la fin d'une liste ordonnée HTML à append()
l' aide de la méthode jQuery. Essayons et voyons comment cela fonctionne :
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery Add Elements to DOM</title>
<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
<script>
$(document).ready(function(){
$("button").click(function(){
$("ol").append("<li>list item</li>");
});
});
</script>
</head>
<body>
<button>Add new list item</button>
<ol>
<li>list item</li>
<li>list item</li>
<li>list item</li>
</ol>
</body>
</html>
De même, vous pouvez ajouter des éléments en haut des éléments appariés.
L'exemple suivant montre comment ajouter un titre HTML au début d'un élément de paragraphe à prepend()
l' aide de la méthode jQuery.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery Add Elements to DOM</title>
<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
<script>
$(document).ready(function(){
$("button").click(function(){
$("p").prepend("<h1>This is a heading</h1>");
});
});
</script>
</head>
<body>
<p>This is a paragraph.</p>
<button>Add heading</button>
</body>
</html>
1638804480
append()
ou prepend()
modalVous pouvez ajouter ou insérer des éléments dans le DOM à l'aide de jQuery append()
ou de prepend()
méthodes. append()
La méthode jQuery insère le contenu à la fin des éléments appariés, tandis que prepend()
cette méthode insère le contenu au début des éléments appariés.
L'exemple suivant vous montrera comment ajouter facilement de nouveaux éléments à la fin d'une liste ordonnée HTML à append()
l' aide de la méthode jQuery. Essayons et voyons comment cela fonctionne :
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery Add Elements to DOM</title>
<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
<script>
$(document).ready(function(){
$("button").click(function(){
$("ol").append("<li>list item</li>");
});
});
</script>
</head>
<body>
<button>Add new list item</button>
<ol>
<li>list item</li>
<li>list item</li>
<li>list item</li>
</ol>
</body>
</html>
De même, vous pouvez ajouter des éléments en haut des éléments appariés.
L'exemple suivant montre comment ajouter un titre HTML au début d'un élément de paragraphe à prepend()
l' aide de la méthode jQuery.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery Add Elements to DOM</title>
<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
<script>
$(document).ready(function(){
$("button").click(function(){
$("p").prepend("<h1>This is a heading</h1>");
});
});
</script>
</head>
<body>
<p>This is a paragraph.</p>
<button>Add heading</button>
</body>
</html>
1592206043
Are You Looking To Hire a jQuery Programmer?
HourlyDeveloper.io, a leading jQuery application development company, can help you build interactive front-end solutions to leapfrog the digital race. So in case, you plan to Hire Dedicated Jquery Developer, you just have to contact us.
For More Information:- https://bit.ly/3f9flt8
#hire dedicated jquery developer #jquery programmer #jquery application development company #jquery developer #jquery #jquerydevelopment
1617257581
¿Quiere restaurar los buzones de correo de PST a Exchange Server? Entonces, estás en la página correcta. Aquí, lo guiaremos sobre cómo puede restaurar fácilmente mensajes y otros elementos de PST a MS Exchange Server.
Muchas veces, los usuarios necesitan restaurar los elementos de datos de PST en Exchange Server, pero debido a la falta de disponibilidad de una solución confiable, los usuarios no pueden obtener la solución. Háganos saber primero sobre el archivo PST y MS Exchange Server.
PST es un formato de archivo utilizado por MS Outlook, un cliente de correo electrónico de Windows y muy popular entre los usuarios domésticos y comerciales.
Por otro lado, Exchange Server es un poderoso servidor de correo electrónico donde todos los datos se almacenan en un archivo EDB. Los usuarios generalmente guardan la copia de seguridad de los buzones de correo de Exchange en el archivo PST, pero muchas veces, los usuarios deben restaurar los datos del archivo PST en Exchange. Para resolver este problema, estamos aquí con una solución profesional que discutiremos en la siguiente sección de esta publicación.
No le recomendamos que elija una solución al azar para restaurar los datos de PST en Exchange Server. Por lo tanto, al realizar varias investigaciones, estamos aquí con una solución inteligente y conveniente, es decir, Exchange Restore Software. Es demasiado fácil de manejar por todos los usuarios y restaurar cómodamente todos los datos del archivo PST a Exchange Server.
El software es demasiado simple de usar y se puede instalar fácilmente en todas las versiones de Windows. Con unos pocos clics, la herramienta puede restaurar los elementos del buzón de Exchange.
No es necesario que MS Outlook restaure los datos PST en Exchange. Todos los correos electrónicos, contactos, notas, calendarios, etc. se restauran desde el archivo PST a Exchange Server.
Todas las versiones de Outlook son compatibles con la herramienta, como Outlook 2019, 2016, 2013, 2010, 2007, etc. La herramienta proporciona varios filtros mediante los cuales se pueden restaurar los datos deseados desde un archivo PST a Exchange Server. El programa se puede instalar en todas las versiones de Windows como Windows 10, 8.1, 8, 7, XP, Vista, etc.
Descargue la versión de demostración del software de restauración de Exchange y analice el funcionamiento del software restaurando los primeros 50 elementos por carpeta.
No existe una solución manual para restaurar los buzones de correo de Exchange desde el archivo PST. Por lo tanto, hemos explicado una solución fácil e inteligente para restaurar datos de archivos PST en Exchange Server. Simplemente puede usar este software y restaurar todos los datos de PST a Exchange Server.
Más información:- https://www.datavare.com/software/exchange-restore.html
#intercambio de software de restauración #intercambio de restauración #buzón del servidor de intercambio #herramienta de restauración de intercambio
1671207305
Select2 jQuery plugin is easy to add on the <select > element. Need to call the select2() method on the selector to initialize.
If you adding select2 on a class or select element and when you add an element dynamically then select2 is not initialized on that element.
In this tutorial, I show how you can initialize select2 on dynamically created HTML <select > element using jQuery.
I am loading select2 data using jQuery AJAX in the example.
I am using users
table in the example –
CREATE TABLE `users` (
`id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT,
`username` varchar(80) NOT NULL,
`name` varchar(80) NOT NULL,
`email` varchar(80) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
Create a config.php
for a database connection.
Completed Code
<?php
$host = "localhost"; /* Host name */
$user = "root"; /* User */
$password = ""; /* Password */
$dbname = "tutorial"; /* Database name */
$con = mysqli_connect($host, $user, $password,$dbname);
// Check connection
if (!$con) {
die("Connection failed: " . mysqli_connect_error());
}
Create a <select class="select2_el" >
element to initialize select2 on page load and create <div id="elements" >
container to store <select >
element on button click using jQuery AJAX.
Completed Code
<select class="select2_el" style='width: 200px;'>
<option value='0'>- Search user -</option>
</select>
<div id='elements'>
</div>
<input type="button" id="btn_add" value="Add">
Create ajaxfile.php
file for handling AJAX requests.
Handle two requests –
$request == 1
then return data for select2.Check if searchTerm
is POST or not. If not POST then fetch all records from users
table otherwise use POST value to search on name
field in users
table to fetch records.
Loop on the fetched records and initialize $data
Array with id
and text
keys. Pass $row['id']
in id
key and $row['name']
in text
key.
Return $data
Array in JSON format.
$request == 2
then return <select class="select2_el" >
element.Completed Code
<?php
include 'config.php';
$request = 1;
if(isset($_POST['request'])){
$request = $_POST['request'];
}
// Select2 data
if($request == 1){
if(!isset($_POST['searchTerm'])){
$fetchData = mysqli_query($con,"select * from users order by name limit 5");
}else{
$search = $_POST['searchTerm'];
$fetchData = mysqli_query($con,"select * from users where name like '%".$search."%' limit 5");
}
$data = array();
while ($row = mysqli_fetch_array($fetchData)) {
$data[] = array("id"=>$row['id'], "text"=>$row['name']);
}
echo json_encode($data);
exit;
}
// Add element
if($request == 2){
$html = "<br><select class='select2_el' ><option value='0'>- Search user -</option></select><br>";
echo $html;
exit;
}
Create initailizeSelect2()
function to initialize select2()
on class="select2_el"
. Use AJAX to load select2 data.
Call initailizeSelect2()
function on document ready state.
Define click event on #btn_add
. Send AJAX POST request to 'ajaxfile.php'
file to add <select >
element on #elements
by appending the response
in #elements
.
Again call the initailizeSelect2()
function to reinitialize the select2 on class="select2_el"
.
Completed Code
$(document).ready(function(){
// Initialize select2
initailizeSelect2();
// Add <select > element
$('#btn_add').click(function(){
$.ajax({
url: 'ajaxfile.php',
type: 'post',
data: {request: 2},
success: function(response){
// Append element
$('#elements').append(response);
// Initialize select2
initailizeSelect2();
}
});
});
});
// Initialize select2
function initailizeSelect2(){
$(".select2_el").select2({
ajax: {
url: "ajaxfile.php",
type: "post",
dataType: 'json',
delay: 250,
data: function (params) {
return {
searchTerm: params.term // search term
};
},
processResults: function (response) {
return {
results: response
};
},
cache: true
}
});
}
You need to reinitialize select2 on the dynamic element.
In the example, I created <select > element using jQuery AJAX and initializing it in class. You can follow the same way to initialize select2 if you are not creating an element using jQuery AJAX.
You can initialize it on element id instead of class if you are getting the id.
If you found this tutorial helpful then don't forget to share.
Original article source at: https://makitweb.com/
1592608380
This video on Querying DOM in jQuery will help you understand the DOM manipulation methods with hands-on.
#jquery #dom in jquery