How we pass the onclick function parameter like this. (Blue - #1da2c3)
<a href="javascript:void(0)"
style="background-color:#af828a;"
@if($split1[0] != $split[0])
onclick="load_varient_color(**Blue - #1da2c3**);"
@endif>
{{$color}}
</a>
CodePudding user response:
Try it,
<a href="javascript:void(0)"
style="background-color:#af828a;"
@if($split1[0] != $split[0])
onclick="load_varient_color('Blue - #1da2c3');"
@endif>
{{$color}}
</a>
CodePudding user response:
Try this if you want to pass "Blue - #1da2c3":
<a href="javascript:void(0)"
style="background-color:#af828a;"
@if($split1[0] != $split[0])
onclick="load_varient_color('Blue - #1da2c3');"
@endif>
{{$color}}
</a>
Or if you want to pass an object {blue: '#1da2c3'} then try this:
<a href="javascript:void(0)"
style="background-color:#af828a;"
@if($split1[0] != $split[0])
onclick="load_varient_color({{ json_encode(['blue' => '#1da2c3') }});"
@endif>
{{$color}}
</a>