All,
I have the following html as a string in javascript. I need to extract a string into "value", broken by the specified divider "|" and put two variables.
var html = '<div><input name="radBtn" class="radClass" style="margin:auto;"
onclick="doSomething();"
value="Apples|4567" type="radio">
</div>';
The required output is two variables with the following values:
fruitName = Apples
fruitNumber = 4567
Note: there may be many radio buttons with the same name.
source
share