Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

NadeemAkhter's avatar

conditional operator on array inside input tag

i want to add a conditional operator inside a input tag. i have some ids on local storage variable when page load they check if id of that check box is exits in local storage variable then this checkbox should be "checked" input tag :

 <input type="checkbox"   onclick="maleClick(checkboxmale{{$mQ->id}},{{$mQ->id}})" value="1" id="checkboxmale{{$mQ->id}}">

local storage array :

var retrievedData = localStorage.getItem("male");
var maleCheckids = JSON.parse(retrievedData);
0 likes
0 replies

Please or to participate in this conversation.