Monday, February 28, 2022

[FIXED] I want to navigate to a div using a button HTML

Issue

I am using this code for button:

 <input type="button"
        style="margin-left:350px"
        id="replybottom"
        name="replybottom"
        onClick="#navigateHere"
        class="button"
        value="Reply"></div>

this is my div:

<div id="navigateHere"
     name="navigateHere"
     class="convomsg12">

Solution

onClick="#navigateHere" This is Wrong way to Navigate.

Instead of that use this code.

   function goto(url)
    {
    window.location=url;

    }

Here your Button

<div onclick="goto('#navigateHere')">Replay</div>

If you want to give button you can give like this

<input type="button"  onclick="goto('#navigateHere')"  value="Replay"/>


Answered By - Dinesh Kanivu

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.