简体   繁体   中英

Laravel Adding Class Name Dynamically

Here is my

{{ Form::text("Article[$i]", $interfacedetload->ArticleNo, array('class'=>'my_prs_inp1 free_enter1','id' => "Article$i")) }}

Which produces

<input class="my_prs_inp1 free_enter1" id="Article2" name="Article[2]" type="text" value="1" style="display: inline-block;">

And so on.. in For Each loop

In the above code i am generating name and id dynamically after Article[x]

That is working good, But How can i add the class name dynamically

ie,

class="my_prs_inp1 free_enter[$i]"

So the class name should be

class="my_prs_inp1 free_enter1"
class="my_prs_inp1 free_enter2"
class="my_prs_inp1 free_enter3"

你这样尝试过吗

{{ Form::text("Article[$i]", $interfacedetload->ArticleNo, array('class'=>"my_prs_inp1 free_enter{$i}",'id' => "Article$i")) }}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM