简体   繁体   中英

How to put Javascript inside a DIv Tag

See the site here

http://www.humblesoftware.com/finance/index

After selecting a particular area, i am updating the Div with this code

$('dateRange').update(dateData[xmin] + ' - ' + dateData[xmax]);


       <div id="dateRange">
    </div>

Actually my question is after updating the div, i want to execute a some function. So is it possible to keep Javascript inside the div tag??

Because if i keep the function after this line

        $('dateRange').update(dateData[xmin] + ' - ' + dateData[xmax]);
alert(date1);

alert(date2); the code is geting executed a number of times (In this case the alerts are coming as soon as the mouse is moved on chart )

Please help

is it possible to keep Javascript inside the div tag? YES
you need to put your script inside <script> tag and pass it to JQuery update method.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM