How should the Dom be in this jQuery code? - html

I have this HTML:
<div class="cart-plus-minus">
<input class="cart-plus-minus-box quantity" id="{{ $item->id }}" name="quantity[{{ $i }}]" value="{{ $item->quantity }}" type="text">
<input name="product_id[{{ $i }}]" value="{{ $item->id }}" type="hidden">
<div class="dec qtybutton" data-id="{{ $item->id }}">
<i class="zmdi zmdi-chevron-down"></i>
</div>
<div class="inc qtybutton" data-id="{{ $item->id }}">
<i class="zmdi zmdi-chevron-up"></i>
</div>
</div>
I have this jQuery code that it does not work:
$('div.cart-plus-minus > div.dec').on('click', function () {
var id = $(this).attr('data-id');
alert(id);
});
How should the dom be If I want to click on dec button and it displays an alert?
I have tried all and it does not work yet.
Thanks!

Related

Modal in Modal Bootstrap 5 CSS

I make modal in the modal, time in the press of the modal button in the modal, do not appear the intended capital, even blank
Has anyone ever done this and the solution?
Transaksi
<h5><i></i> Create Transaction </h5>
<i></i> Transaction
#csrf
<i></i> Member</a>
<button type="button" class="btn btn-sm btn-primary " data-bs-toggle="modal" data-bs-target="#choosePackageModal">
<i class="bi bi-plus"></i> Paket</a>
</button>
</div>
<div class="mb-3">
<label for="transaction_date" class="form-label">Tanggal Transaksi</label>
<input type="date" name="date" value="{{ date('Y-m-d') }}" class="form-control #error('date') is-invalid #enderror" id="date">
#error('date')
<div class="invalid-feedback">
{{ $message }}
</div>
#enderror
</div>
<div class="mb-3">
<label for="deadline" class="form-label">Estimasi Selesai</label>
<input type="date" name="deadline" value="{{ date('Y-m-d', strtotime(date('Y-m-d') . ' + 3 day')) }}" class="form-control #error('deadline') is-invalid #enderror">
#error('deadline')
<span class="invalid-feedback">
{{ $message }}
</span>
#enderror
</div>
<div class="mb-3">
<label for="additional_cost" class="form-label">Biaya Tambahan</label>
<input type="number" name="additional_cost" value="{{ old('additional_cost') }}" class="form-control #error('additional_cost') is-invalid #enderror">
#error('additional_cost')
<span class="invalid-feedback">
{{ $message }}
</span>
#enderror
</div>
<div class="mb-3">
<label for="paid" class="form-label">Pembayaran</label>
<input type="number" name="paid" value="{{ old('paid') }}" class="form-control #error('paid') is-invalid #enderror">
#error('paid')
<span class="invalid-feedback">
{{ $message }}
</span>
#enderror
</div>
<div class="mb-3">
<label for="status" class="form-label">Status Bayar</label>
<select class="form-select form-select mb-3" aria-label=".form-select example" name="status">
<option selected>-- Select status --</option>
<option value="Sudah Dibayar">Bayar Sekarang</option>
<option value="Belum Dibayar">Belum Bayar</option>
</select>
</div>
<button type="submit" class="btn btn-sm btn-primary"><i class="bi bi-plus"></i> Create</button>
</form>
</div>
</div>
</div>
<h5><i></i> Pilih Member </h5>
<i></i> Member
#
Nama Pelanggan
Alamat
Gender
No. Telp
Pilih
#php
$no = 1;
#endphp
#foreach ($members as $member)
{{ $no++; }}
{{ $member->name }}
{{ $member->address }}
{{ $member->gender }}
{{ $member->phone }}
<i></i>
#endforeach
My hope is that when the + Member button is clicked, then the intended capital appears, but when I click, the page becomes blank

HTML page, load 10 items, then wait for scroll and load more

I have a list of so many items that loading them all at the time is very uncomfortable and takes a long time. I would like to implement a script that loads only 10 items and waits for scroll to load more. However I have no idea how to code it.
This is how my page looks:
{% extends "layout.html" %}
{% block content %}
<div class="container">
{% for i in range(data|length) %}
<div class="re-container">
<div class="re-container-item">
<div class="re-item">
<image class="re-img" src="{{url_for('static', filename='img/' + data.UNIQUE_RE_NUMBER[i].replace('/', '-') + '.jpg')}}" onerror="if (this.src != 'static/img/default.jpg') this.src = 'static/img/default.jpg';"></image>
</div>
</div>
<div class="re-container-item">
<div class="re-item">
<p>{{ data.LOCATION[i] }}</p>
<p class="re-date"> {{ data.MIN_DATE[i] }} - {{ data.MAX_DATE[i] }} </p>
</div>
<div class="re-item">
<p>{{ data.ADDRSS[i] }}</p>
</div>
<div class="re-item">
<p><a class="article-title" href="{{url_for('/dashapp/', ure=data.UNIQUE_RE_NUMBER[i])}}">{{data.UNIQUE_RE_NUMBER[i]}}</a></p>
<p class="re-price">{{data.RE_PRICE[i]}}</p>
<hr>
</div>
<div class="re-item">
<p>{{data.RE_INFO[i]}}</p>
</div>
{% if current_user.is_authenticated %}
<div class="re-item">
<form action="{{ url_for('saved') }}" method="POST">
<input type="hidden" value="{{ data.LOCATION[i] }}" name="location">
<input type="hidden" value="{{ data.UNIQUE_RE_NUMBER[i] }}" name="unique">
<input type="hidden" value="{{ data.ADDRSS[i] }}" name="address">
<input type="hidden" value="{{ data.RE_INFO[i] }}" name="info">
<input type="hidden" value="{{ data.RE_HREF[i] }}" name="href">
<input type="hidden" value="{{ data.TYP_ID[i] }}" name="typ">
<input type="hidden" value="{{ data.RE_POLOHA[i] }}" name="poloha">
<input type="hidden" value="{{ data.RE_DRUH[i] }}" name="druh">
<input type="hidden" value="{{ data.RE_TYP[i] }}" name="re-typ">
<input type="hidden" value="" name="dispozice">
<input type="hidden" value="" name="f_druh">
<input type="hidden" value="" name="pplocha">
<input type="hidden" value="" name="plocha">
<input type="hidden" value="" name="l_druh">
<input type="hidden" value="" name="site">
<input type="hidden" value="{{ data.MIN_DATE[i] }}" name="min_d">
<button class="re-button" type="submit">Save</button>
</form>
</div>
{% endif %}
<div class="re-item">
<p>Poloha domu/vily: {{data.RE_POLOHA[i]}}</p>
</div>
<div class="re-item">
<p>Druh domu/vily: {{data.RE_DRUH[i]}}</p>
</div>
<div class="re-item">
<p>Typ domu/vily: {{data.RE_TYP[i]}}</p>
</div>
<div class="re-item">
{% if data.RE_HREF[i] != None %}
More here
{% endif %}
</div>
</div>
</div>
{% endfor %}
</div>
{% endblock content %}
Does anyone have some suggestion?
You can use the loading attribute in HTML. Just like below.
<img src="niceCats.jpg" loading="lazy">
I would advise you to read this aricle that CSSTrick put up on their page. Note this attribute is not supported on any safari version for IOS.

How to store selected checkbox IDs to my database on Laravel 8

I have created a dynamic survey builder application, where the survey creator can choose what question type the question that will be made (either radio, checkbox, text and textarea). The storing of user's responses are saving correctly EXCEPT on my checkboxes. If the user selected 3 or 2 checkboxes then it will only save 1 to the database. Please help I am new to laravel. Thank you
This is my store function in controller
public function surveystore(Questionnaire $questionnaire, Request $request){
$data = request()->validate([
'responses.*.answer_id' => 'required_if:responses.*.questiontype,radio,|required_if:responses.*.questiontype,checkbox',
'responses.*.answer_text' => 'required_if:responses.*.questiontype,text,|required_if:responses.*.questiontype,textarea',
'responses.*.question_id' => 'required',
'survey.name' => 'required', //present ang ilagay kung need na confidential
'survey.email' => 'required', //present ang ilagay kung need na confidential
]);
$survey= $questionnaire->surveys()->create($data['survey']);
$survey->responses()->createMany($data['responses']);
return redirect()->back()->with('message', 'Thank You! :)');
}
This is my route
Route::get('dsb/creator/surveys/{questionnaire}-{slug}', [dsbCreatorController::class, 'surveyshow'])->name('dsb/creator/surveyshow/{questionnaire}-{slug}');
Route::post('dsb/creator/surveys/{questionnaire}-{slug}', [dsbCreatorController::class, 'surveystore'])->name('dsb/creator/surveystore/{questionnaire}-{slug}');
This is my surveyshow.blade.php (the survey form that the users will take to answer)
<div class="container">
#if(session()->has('message'))
<div class="alert alert-success">
{{ session()->get('message') }}
</div>
#endif
<div class="card mt-4">
<div class="card-body">
<div class="header text-center ml-auto mr-auto">
<h3 class= "font-bold">Survey Title: {{ $questionnaire->title }}</h3>
<h4>Purpose: {{ $questionnaire->purpose }}</h4>
</div>
</div>
</div>
<form action="/dsb/creator/surveys/{{ $questionnaire->id}}-{{ Str::slug($questionnaire->title) }}" method="post">
#csrf
#foreach ($questionnaire->questions as $key => $question)
<div class="card mt-4">
<div class="card-header"><strong>{{ $key + 1}}</strong> {{ $question->question }}</div>
#if($question->questiontype === 'radio')
<div class="card-body">
#error('responses.'. $key . '.answer_id')
<small class="text-danger">{{ $message }}</small>
#enderror
<ul class="list-group">
#foreach($question->answers as $answer)
<label for="answer{{ $answer->id }}">
<li class="list-group-item">
<input type="radio" name="responses[{{ $key }}][answer_id]" id="answer{{ $answer->id }}"
{{ (old('responses.' . $key . '.answer_id')== $answer->id) ? 'checked' : ''}}
class="mr-2" value="{{ $answer->id }}">
{{ $answer->answer }}
<input type="hidden" name="responses[{{ $key }}][question_id]" value="{{ $question->id }}">
<input type="hidden" name="responses[{{ $key }}][questiontype]" value="{{ $question->questiontype }}">
<input type="hidden" name="responses[{{ $key }}][required]" value="{{ $question->required }}">
</li>
</label>
#endforeach
</ul>
</div>
#elseif($question->questiontype === 'text')
<div class="card-body">
#error('responses.'. $key . '.answer_text')
<small class="text-danger">{{ $message }}</small>
#enderror
<div class="input-field col s12">
<input type="text" name="responses[{{ $key }}][answer_text]">
<input type="hidden" name="responses[{{ $key }}][question_id]" value="{{ $question->id }}">
<input type="hidden" name="responses[{{ $key }}][questiontype]" value="{{ $question->questiontype }}">
<input type="hidden" name="responses[{{ $key }}][required]" value="{{ $question->required }}">
<label for="responses[{{ $key }}][answer_text]">Provide answer</label>
</div>
</div>
#elseif($question->questiontype === 'textarea')
<div class="card-body">
#error('responses.'. $key . '.answer_text')
<small class="text-danger">{{ $message }}</small>
#enderror
<div class="input-field col s12">
<textarea name="responses[{{ $key }}][answer_text]"></textarea>
<input type="hidden" name="responses[{{ $key }}][question_id]" value="{{ $question->id }}">
<input type="hidden" name="responses[{{ $key }}][questiontype]" value="{{ $question->questiontype }}">
<input type="hidden" name="responses[{{ $key }}][required]" value="{{ $question->required }}">
<label for="responses[{{ $key }}][answer_text]">Provide answer</label>
</div>
</div>
#elseif($question->questiontype === 'checkbox')
<div class="card-body">
#error('responses.'. $key . '.answer_id')
<small class="text-danger">{{ $message }}</small>
#enderror
<ul class="list-group">
#foreach($question->answers as $answer)
<label for="answer{{ $answer->id }}">
<li class="list-group-item">
<input type="checkbox" name="responses[{{ $key }}][answer_id][]" id="answer{{ $answer->id }}"
{{ (old('responses.' . $key . '.answer_id')== $answer->id) ? 'checked' : ''}}
class="mr-2" value="{{ $answer->id }}">
{{ $answer->answer }}
<input type="hidden" name="responses[{{ $key }}][question_id]" value="{{ $question->id }}">
<input type="hidden" name="responses[{{ $key }}][questiontype]" value="{{ $question->questiontype }}">
<input type="hidden" name="responses[{{ $key }}][required]" value="{{ $question->required }}">
</li>
</label>
#endforeach
</ul>
</div>
#endif
</div>
#endforeach
<br><br>
<div class="card">
<div class="card-header">Your Information:
<small id="info" class="form-text text-muted">(NOT REQUIRED)</small>
</div> <br>
<div class="card-body">
<div class="form-group">
<label for="name">Name</label>
<input name="survey[name]" type="text" class="form-control" id="name" aria-describedby="nameHelp" placeholder="Enter Name">
#error('name')
<small class="text-danger">{{$message}}</small>
#enderror
</div> <br>
<div class="form-group">
<label for="email">Email</label>
<input name="survey[email]" type="text" class="form-control" id="email" aria-describedby="emailHelp" placeholder="Enter email">
#error('email')
<small class="text-danger">{{$message}}</small>
#enderror
</div>
<div>
<br>
<br>
<button type="submit" class="btn btn-primary">Complete survey</button>
</div>
</div>
</form>
</div>
This is my SurveyResponse Model's function
use HasFactory;
protected $guarded = [];
public function survey()
{
return $this->belongsTo(Survey::class);
}
public function questionnaire()
{
return $this->belongsTo(Questionnaire::class);
}
}
array:4 [▼
0 => array:2 [▼ "answer_id" => "89" "question_id" => "103" ]
1 => array:2 [▼ "answer_id" => array:2 [▼ 0 => "90" 1 => "91" ] "question_id" => "104" ]
2 => array:2 [▼ "answer_text" => "answer to text" "question_id" => "105" ]
3 => array:2 [▼ "answer_text" => "answer to textarea" "question_id" => "106" ] ]
in the second index answer_id is an array. createMany() method can't handle this properly.I think that causes the problem.You can change your code with a foreach loop for storing $data['responses'] and check if value is an array.If it is then iterate over again to save.For example;
foreach ($data['responses'] as $response) {
if (isset($response['answer_id']) && is_array($response['answer_id'])) {
foreach ($response['answer_id'] as $value) {
$survey->responses()->createOne(
[
"answer_id" => $value,
"question_id" => $response['question_id']
]
);
}
} else {
$survey->responses()->createOne($response);
}
}

Symfony - pass GET parameters to another route?

I have a table with filters, and i want to download the rows as csv, filtered.
My function to get filters from form:
public function getFilters($request)
{
$filters = [
'stato' => $request->get('stato'),
'cliente' => $request->get('cliente'),
'registrar' => $request->get('registrar'),
'creazione_inizio' => $request->get('creazione_inizio'),
'creazione_fine' => $request->get('creazione_fine'),
'scadenza_inizio' => $request->get('scadenza_inizio'),
'scadenza_fine' => $request->get('scadenza_fine'),
'scadenza_pagamento_inizio' => $request->get('scadenza_pagamento_inizio'),
'scadenza_pagamento_fine' => $request->get('scadenza_pagamento_fine'),
];
return $filters;
}
On the page where the table is i have this code and it works fine:
/**
* #Route("/dashboard", name="dashboard")
*/
public function dashboard(Request $request, PaginatorInterface $paginator): Response
{
$filters = $this->getFilters($request);
}
But on the route to export csv i have this and $filters is always null:
/**
* #Route("/report/report.csv", name="domains_data_csv")
*/
public function exportDomainsDataCsvAction(Request $request)
{
$filters = $this->getFilters($request);
}
I have the filters form and the button to download csv on the dashboard page.
Any tips to make it work?
EDIT
My dashboard page is made like this:
<div class="mb-2">
<span class="h2">Dashboard</span>
</div>
<div class="mb-3">
{{ include('Admin/includes/_search.html.twig') }}
</div>
{{ include('Admin/includes/_filter.html.twig') }}
{% if domains %}
<div class="col-auto">
Scarica CSV
</div>
{{ include('Admin/includes/_domains_table.html.twig',{ 'domains':domains }) }}
{% if is_granted('ROLE_ADMIN') %}
<a class="btn btn-primary" aria-current="page" href="{{path('new_domain')}}" role="button">Nuovo dominio</a>
{% endif %}
{% else %}
{% endif %}
Filters form:
<div class="card">
<div class="row align-items-center">
<a class="text-decoration-none text-reset" id="filter-header" href="#collapseExample" data-bs-toggle="collapse" aria-expanded="false">
<div class="card-header d-flex align-items-center">
<h5 class="pe-3">Filtri</h5>
<div class="border-1 bg-success border border-success w-100" style="opacity:unset;"></div>
<i class="bi bi-chevron-right ps-3 fs-3 text-success arrow"></i>
</div>
</a>
</div>
<div class="collapse" id="collapseExample">
<div class="card-body">
<form id="form-filter-status" method="GET">
{% if is_granted('ROLE_ADMIN') %}
<div class="row mb-3 justify-content-center">
<div class="card col-sm-3 mx-3">
<div class="card-body">
<div class="card-title">Stato:</div>
<div class="col-sm">
<select name="stato" class="form-select" onchange='this.form.submit();'>
<option value="" {% if filters.stato is empty %} selected {% endif %}>Seleziona...</option>
<option value="1" {% if filters.stato == 1 %} selected {% endif %}>Attivo</option>
<option value="2" {% if filters.stato == 2 %} selected {% endif %}>Richiesta Dismissione</option>
<option value="3" {% if filters.stato == 3 %} selected {% endif %}>Dismesso</option>
<option value="4" {% if filters.stato == 4 %} selected {% endif %}>Richiesto Trasferimento</option>
<option value="5" {% if filters.stato == 5 %} selected {% endif %}>Trasferito</option>
</select>
</div>
</div>
</div>
<div class="card col-sm-3 mx-3">
<div class="card-body">
<div class="card-title">Cliente:</div>
<div class="col-sm">
<select name="cliente" class="form-select" onchange='this.form.submit();'>
<option value="" {% if filters.cliente is empty %} selected {% endif %}>Seleziona...</option>
<option value="1" {% if filters.cliente == 1 %} selected {% endif %}>KINETIKON s.r.l.</option>
<option value="2" {% if filters.cliente == 2 %} selected {% endif %}>CINQUEBIT s.r.l.</option>
<option value="3" {% if filters.cliente == 3 %} selected {% endif %}>JAKALA S.p.A.</option>
<option value="4" {% if filters.cliente == 4 %} selected {% endif %}>IN.SI. s.r.l.</option>
<option value="5" {% if filters.cliente == 5 %} selected {% endif %}>PAGNOSSIN s.r.l.</option>
<option value="6" {% if filters.cliente == 6 %} selected {% endif %}>ELEPHASE s.r.l.</option>
</select>
</div>
</div>
</div>
<div class="card col-sm-3 mx-3">
<div class="card-body">
<div class="card-title">Register:</div>
<div class="col-sm">
<select name="registrar" class="form-select" onchange='this.form.submit();'>
<option value="" {% if filters.registrar is empty %} selected {% endif %}>Seleziona...</option>
<option value="1" {% if filters.registrar == 1 %} selected {% endif %}>Register</option>
<option value="2" {% if filters.registrar == 2 %} selected {% endif %}>OpenProvider</option>
<option value="3" {% if filters.registrar == 3 %} selected {% endif %}>TowerTech</option>
<option value="4" {% if filters.registrar == 4 %} selected {% endif %}>Aruba</option>
<option value="5" {% if filters.registrar == 5 %} selected {% endif %}>Aruba Business</option>
</select>
</div>
</div>
</div>
</div>
{% endif %}
<div class="row justify-content-center">
<div class="card col-sm-3 mx-3">
<div class="card-body">
<div class="card-title">Creazione</div>
<div class="input-group mb-3">
<span class="input-group-text col-2" id="creazione_inizio">Da:</span>
<input type="date" name="creazione_inizio" class="form-control" value="{{filters.creazione_inizio}}" placeholder="Creazione inizio" aria-label="Creazione inizio" aria-describedby="creazione_inizio">
</div>
<div class="input-group mb-3">
<span class="input-group-text col-2" id="creazione_fine">A:</span>
<input type="date" name="creazione_fine" class="form-control" value="{{filters.creazione_fine}}" placeholder="Creazione fine" aria-label="Creazione fine" aria-describedby="creazione_fine">
</div>
<div class="d-grid gap-2">
<button class="btn btn-outline-success" type="submit">Filtra data creazione</button>
</div>
</div>
</div>
<div class="card col-sm-3 mx-3">
<div class="card-body">
<div class="card-title">Scadenza</div>
<div class="input-group mb-3">
<span class="input-group-text col-2" id="scadenza_inizio">Da:</span>
<input type="date" name="scadenza_inizio" class="form-control" value="{{filters.scadenza_inizio}}" placeholder="Scadenza inizio" aria-label="Scadenza inizio" aria-describedby="scadenza_inizio">
</div>
<div class="input-group mb-3">
<span class="input-group-text col-2" id="scadenza_fine">A:</span>
<input type="date" name="scadenza_fine" class="form-control" value="{{filters.scadenza_fine}}" placeholder="Scadenza fine" aria-label="Scadenza fine" aria-describedby="scadenza_fine">
</div>
<div class="d-grid gap-2">
<button class="btn btn-outline-success" type="submit">Filtra data scadenza</button>
</div>
</div>
</div>
<div class="card col-sm-3 mx-3">
<div class="card-body">
<div class="card-title">Scadenza pagamento</div>
<div class="input-group mb-3">
<span class="input-group-text col-2" id="scadenza_pagamento_inizio">Da:</span>
<input type="date" name="scadenza_pagamento_inizio" class="form-control" value="{{filters.scadenza_pagamento_inizio}}" placeholder="Scadenza pagamento inizio" aria-label="Scadenza pagamento inizio" aria-describedby="scadenza_pagamento_inizio">
</div>
<div class="input-group mb-3">
<span class="input-group-text col-2" id="scadenza_pagamento_fine">Da:</span>
<input type="date" name="scadenza_pagamento_fine" class="form-control" value="{{filters.scadenza_pagamento_fine}}" placeholder="Scadenza pagamento fine" aria-label="Scadenza pagamento fine" aria-describedby="scadenza_pagamento_fine">
</div>
<div class="d-grid gap-2">
<button class="btn btn-outline-success" type="submit">Filtra data scadenza pagamento</button>
</div>
</div>
</div>
</div>
{% if query is defined %}
<input type="hidden" name="query" value="{{query}}">
{% endif %}
</form>
</div>
</div>
To pass the current GET parameters (from URL, not form) You should be able to modify the href as follows:
Scarica CSV
To use the current form values you need to use JavaScript to set the form's action attribute value to that returned by {{ path('domains_data_csv') }} and submit the form.

How to loop foreach in blade while using jquery in Laravel

I'm using Laravel 5.4 and I have never tried jquery so I have no idea what I'm doing, unfortunately.
This is my blade:
<h3>Comments:</h3>
<ul class="list-unstyled activity-list">
#foreach ($threads->comments()->where('parent', 0)->orderBy('created_at', 'desc')->get() as $comment)
<li>
<img src="{{ $comment->user->getAvatar() }}" alt="Avatar" class="img-circle pull-left avatar">
<p><a href="{{ route('profile.view', $comment->user->id) }}">
{{ $comment->user->user_name }}</a>:
<br>
{{ $comment->content }}
<span class="timestamp">{{ $comment->created_at->diffForHumans() }}</span>
</p>
#if ($threads->lock == 0)
<a id="btn-comment" style="padding-left:3.5em">reply</a>
<br>
<form action="{{ route('threads.comments.add') }}" id="comment" method="POST" style="padding-left:3.5em; display:none;">
{{ csrf_field() }}
<input type="hidden" name="thread_id" value="{{ $threads->id }}">
<input type="hidden" name="parent" value="{{ $comment->id }}">
<input type="text" name="content" class="form-control" placeholder="Add reply...">
<input type="submit" class="btn btn-primary btn-xs" value="Add Reply">
</form>
<br>
#endif
#foreach ($comment->childs as $child)
<div style="padding-left:3.5em;">
<img src="{{ $child->user->getAvatar() }}" alt="Avatar" class="img-circle pull-left avatar">
<p><a href="{{ route('profile.view', $child->user->id) }}">
<span style="padding-left:1em;">{{ $child->user->user_name }}</a>: </span>
<br>
<span style="padding-left:1em;">{{ $child->content }}</span>
<span class="timestamp" style="padding-left:4.3em;">{{ $child->created_at->diffForHumans() }}</span>
</p>
</div>
#endforeach
</li>
#endforeach
</ul>
Here's my custom script:
<script>
$(document).ready(function(){
$('#btn-comment').click(function(){
$('#comment').toggle('slide');
});
});
</script>
These lines specifically are the ones that I'm trying to run using the script above:
#if ($threads->lock == 0)
<a id="btn-comment" style="padding-left:3.5em">reply</a>
<br>
<form action="{{ route('threads.comments.add') }}" id="comment" method="POST" style="padding-left:3.5em; display:none;">
{{ csrf_field() }}
<input type="hidden" name="thread_id" value="{{ $threads->id }}">
<input type="hidden" name="parent" value="{{ $comment->id }}">
<input type="text" name="content" class="form-control" placeholder="Add reply...">
<input type="submit" class="btn btn-primary btn-xs" value="Add Reply">
</form>
<br>
#endif
Ask me if you need further detail