Now we would make 2 States named as TextHeight and TextWidth and set the default height and width is 100 100. Example : replaceButtonText ('myButton1', 'new button text') That will replace the text of the button with the id 'myButton' with 'new button text'. We do this by simply adding the following line into the header of the page. Import StyleSheet, View, Button and Text component in your project. The text in the HTML I want to change here is represented by "$row" $(".ajax-unlike"). To call this function, pass the ID of the button element ( buttonID) and the text to put into the button. These are my javascript & html snippets if they help. If they unlike, change from 2 to 1, etc.Ĭan anyone suggest an approach to look into? if someone likes, change the text from 10 to 11. Click Here: TARGET.appendChild(ELEMENT) Append a new element into the container. Click Here: createElement(TAG NAME) Create a new HTML element. Then we'll see how the more modern 'click' eventListner works, which lets you separate the HTML from the JavaScript. First, we'll look at the traditional onclick style that you do right from the HTML page. and then a php script handles all the DB magic.īut I can't wrap my head around how to change the actual text value shown i.e. Click Here: ELEMENT.outerHTML: Get/set the HTML of the entire element. In this tutorial, we are going to explore the two different ways of executing click events in JavaScript using two different methods.