Home > Enterprise >  Guidance making interactive buttons in JavaScript
Guidance making interactive buttons in JavaScript

Time:06-07

I'm new to JavaScript and I am stuck on exactly how to start in my text editor? I've tried googling but I'm getting mixed answers.

I'm trying to make four interactive buttons in a browser. I just don't know how to start? My file is open and the text editor is aware I am using JavaScript.

Now, do I need to start with a script tag? Then what should be the next steps? If anyone could provide me with a little guidance on how I should be thinking in my steps id greatly appreciate it.. Thank you very much

CodePudding user response:

Start with the Hello World of using a Button HTML tag and script that handles a click event.

For example -- here is the Button defined in HTML.

<button type="submit"  id="HelloButton">Say  Hello</button>

Now in a separate JS Script, you can handle the click event:

$(function() {

    $("#HelloButton" ).click(function($e) {

       alert("Say Hello"); 
        
    } );// END of the button click event
 } );

This uses JQUERY as well (in case you want to follow it).

CodePudding user response:

It sounds like you can benefit from YouTube tutorials. Learn HTML, CSS, and then JavaScript. Also, incorporate TailwindCSS. For the code editor utilize VS Code. If you don't immediately understand something, keep in mind that it's ok, and most of the time, we know things more with time and practice.

  • Related