Can i select a specific class using id

Alex Lord
Alex Lord used Ask the Experts™
on
$(".modal-body").html(response.data);

Open in new window


am i able to get this class by using i Id to isolate it from other classes.



<div class="modal fade show" id="newModalWindow" tabindex="-1" role="dialog" aria-labelledby="newModalTitle" style="padding-right: 15px; display: block;"><div class="modal-dialog modal-dialog-centered modal-sm" role="document"><div class="modal-content"><div class="modal-header"><h5 class="modal-title" id="newModalTitle">Edit Note</h5><button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button></div><div class="modal-body" style="padding: 1rem;"><form id="update-note-form" class="form-horizontal">
							<div class="form-group">
							<label class="col-md-12 control-label" for="textarea">Note</label>
							<div class="col-md-12">                     
								<textarea class="form-control" form="update-note-form" id="TEXT" name="TEXT">edit deal note</textarea>
								<input id="noteID" name="noteID" type="hidden" value="">
								<input id="subaction" name="subaction" type="hidden" value="update-note">
							</div>
							</div>			
						</form>
							</div><div class="modal-footer"><button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button><button id="update-Note" type="button" class="btn btn-success">Save</button></div></div></div></div>

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Most Valuable Expert 2018
Distinguished Expert 2018

Commented:
Sure:

$("#newModalWindow .modal-body")

Open in new window

leakim971Multitechnician
Top Expert 2014

Commented:
I like this notation too :
$(".modal-body", "#newModalWindow")

all element in id="newModalWindow" :
$("*", "#newModalWindow")
Analyst Developer
Distinguished Expert 2018
Commented:
You could use the jQuery method find() for this like :

$("#newModalWindow").find(".modal-body");

Open in new window

Zakaria AcharkiAnalyst Developer
Distinguished Expert 2018

Commented:
Our suggestions work for you @Alex?

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial