To change the value of the data-start
attribute by adding +
to the preselected time, the following code snippet can be used:
index.tsx466 chars15 lines
Explanation:
$( )
function and the attribute selector []
.data-start
attribute using .attr( )
method.parseInt( )
function is used to convert a string to an integer so that we can perform an arithmetic operation.+
to the startTimeInt
variable to create a new string with +
appended to the value of data-start
attribute.data-start
attribute to the new start time using .attr( )
method.gistlibby LogSnag