Replace jQuery with JavaScript

mod_harbour is an Apache module that allows to run PRGs directly on the web !!!

Replace jQuery with JavaScript

Postby Otto » Tue Jul 16, 2024 7:30 am

Replace jQuery with Vanilla JavaScript
Due to a modern trend of replacing jQuery with native JavaScript, you might consider this to modernize your application and reduce dependencies.

Steps to Remove jQuery
Analyze the Use of jQuery:
Search your code for $ and jQuery to identify where jQuery is being used.
Replace jQuery with Vanilla JavaScript:
Most jQuery functions have corresponding Vanilla JavaScript alternatives.
Here are some examples of how to replace jQuery with Vanilla JavaScript:

Examples
jQuery: DOM-Ready
$(document).ready(function () {
// Code here
});
Vanilla JavaScript:

document.addEventListener('DOMContentLoaded', function () {
// Code here
});
jQuery: DOM Selection
var element = $('#elementId');
Vanilla JavaScript:

var element = document.getElementById('elementId');
jQuery: Change CSS
$('#elementId').css('color', 'red');
Vanilla JavaScript:

document.getElementById('elementId').style.color = 'red';
jQuery: Add Event Listener
$('#elementId').on('click', function () {
// Code here
});
Vanilla JavaScript:

document.getElementById('elementId').addEventListener('click', function () {
// Code here
});
Example: Replacing jQuery with Vanilla JavaScript
Before:
$(document).ready(function () {
$('#button').click(function () {
alert('Button clicked');
});
});
After:
document.addEventListener('DOMContentLoaded', function () {
document.getElementById('button').addEventListener('click', function () {
alert('Button clicked');
});
});
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6364
Joined: Fri Oct 07, 2005 7:07 pm

Re: Replace jQuery with JavaScript

Postby reinaldocrespo » Tue Jul 16, 2024 12:11 pm

Hello Otto;

If you were to organize another FWH-ModHarbour-WEB-SQL summit, I would attend. The summit from 2017 was a great experience for me.

As you mature on your web development, it seems to me like you have been gravitating more and more towards PHP and Javascript (and I'm guessing HTML + CSS). Would you agree?

Thank you.
User avatar
reinaldocrespo
 
Posts: 979
Joined: Thu Nov 17, 2005 5:49 pm
Location: Fort Lauderdale, FL

Re: Replace jQuery with JavaScript

Postby Otto » Tue Jul 16, 2024 11:23 pm

Dear Reinaldo,

I am glad you still remember the meeting. You were such a good moderator and speaker. The presentations were really interesting, and we made many friendships.
Knowing each other personally is different. I think everyone benefited from it in their work.

I have always used HTML and JS for the client side. When Antonio released Mod Harbour, I started thinking seriously about making a web version of WINHOTEL.
I have been working on it since then.

It's a shame that Mod Harbour has not caught on in our group yet and there is no clear plan. There are many ideas on how to make the transition easier.

I think it depends on personal situations. How long should your program stay in use? Do you have someone to continue developing the program?
Do you work with large data volumes? Are you making an in-house solution just for your business, or do you need to sell it?

For me, we have small databases the DBF files work well. I don't need an SQL server, and I can install my programs just by copying the exe. This is important for sales.

Our customers work remotely. We have a server (a SERVERBOOK) and all workstations access their programs on the server remotely. The EXEs are on the server. We use a separate EXE for each user.

We are now also installing an APACHE server on these SERVERBOOKS and running the web version of WINHOTEL there.

I have a problem with the Android REMOTER software. The programmer who made this program for accessing the remote server from ANDROID now has different priorities and stopped developing the program.

So, I urgently need the web version of our ordering system. I have almost finished programming it. I decided to use PHP for the endpoint.

I think if we make it easy for PHP web developers to access DBF, there is a big market for it. There are no simple alternatives to DBF for databases for web programs. SQL usually costs money or cannot be installed.

By working more with DBF fileformat and concept, I have learned a lot. It is also interesting that a simple post on Facebook how to access from PHP DBF at modharbour.club had the most views of all posts so far.
I think these web developers and also the "EXCEL programmers" would be a target group for us to get new users for FIVEWIN.
Especially with EXCEL, if someone really wants a program, there are no simple development options anymore.

I would be happy if you share your experiences and I can learn from you.

Organizing a meeting is not the problem, but I think it is hard to motivate participants to come.

Best regards,
Otto

AD SERVERBOOK ) viewtopic.php?f=3&t=25121&p=136824&hilit=serverbook&sid=39b9b5302453765e2676e9eb71db97ff#p136824
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6364
Joined: Fri Oct 07, 2005 7:07 pm


Return to mod_harbour

Who is online

Users browsing this forum: No registered users and 3 guests