Skip to content
Advertisement

Create a simple page redirect system in WP based on IDs

What I’m trying to do is to have my students enter their name (assigned code) in a field and once they click the “Go” button they will be redirected to their page. I’m trying to do this in WP and I’m already working with a theme. I don’t have any programming knowledge for myself but I have this code from a friend. Unfortunately, the code doesn’t work in WP as the “onclick” atribute is stripped automatically.

This is how the head section looks like:

JavaScript

This is the body section:

JavaScript

And I “define” my student IDs in the students.js which looks like this:

JavaScript

Do you know how can I accomplish this in a more modern way? From my understanding the .click() event in jQuery is what I’m looking for. Unfortunately I don’t know exactly how to code this. Any help is appreciated.

Advertisement

Answer

You can do something like this

HTML

JavaScript

jQuery

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement