How to get primefaces elements value with javascript [closed] - javascript

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
I have a primefaces project and I'm facing a problem. I have a simple HTML component which is an input element of type hidden which gets its value from a backend bean. Now I need the value of that component as a javascript variable in order to validate it.
How can I access the value from the hidden input element?

For the next time, please post what you have tried so far. You can't expect us to write code for you. Show a little bit of effort. But because in that case it is not too much:
If you have something like this
<input id="myHiddenComponent" type="hidden" value="something received from your bean" />
you can access it with jQuery for example
$('input#myHiddenComponent').val();
If you dont know the id, you can use other jQuery selectors and the jQuery find as well, pick one which suits you.

Related

what is the fastest way to find what component is showing that particular div on the DOM? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 3 days ago.
Improve this question
Here is my current way of finding what component is showing that particular div:
I copy the class name (I use Tailwind, so I mostly get unique classes) or hardcoded text that is present and search for it in my project, then I figure out on which component that name or text is present.
but i was wondering if there is any faster way to find it?
Try using the Locatorjs chrome extension. Enable the extension and in localhost hover over the component in UI for which you want to see the code. In mac, OPTION + CLICK will take you to that particular code.Locatorjs

Is there way to dynamically click bind every word in a div [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
I am trying to bind every word in an element without actually changing the markup in the element with Javascript
The short answer: No.
If you REALLY wanted to do this, I suppose you could write a script that went through the div and manually added the markup for you. And then you could add click events to the automatically added markup.
But then you would just be writing a script that adds the markup you don't want to.
So long answer: No, not without adding markup in some context.

JavaScript custom prompt boxes without using jQuery [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
First poster here, but I wanted to know if there was anyway that it was possible to customize the JavaScript prompt boxes without using jQuery? I'm wanting to keep my site vanilla as possible. Thanks.
You can create your own modal dialog boxes. However you cannot customize how, for example, window.alert("Hello!") would look. That is completely up to the browser manufacturer.
create a 'div' and show that using an event.

Get number with javascript [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I have a Javascript Bookmarlet, in which I want to grab a price that might be displayed on the current page.
So for example on shopping sites it could grab the price of an item the user is currently looking at.
I figured one way would be to grab all the text on the page, perhaps with something like get web page text via javascript
And then from there filter to get just the number after a currency symbol is found (£,$ etc) which should in theory leave just the Price.
However I am now sure how I would go about actually filtering to just the number, and if this is at all the right way to go about this?
How about get the text value of mark up?
E.g. Say you had:
<span id="price">£5.00</span>
You could do the following with jQuery:
$('#price').text();
Or vanilla javascript:
document.getElementById('price').innerText
Provided there is infact a wrapper around the text or you have access to the markup.

Little box where I could write in [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
I would need to use a little textbox in order to write in and to get the value but without creating a window. (In which I would have created a textbox element)
I would need something like the alert box but I would like to write in.
Do you know what I could use ?
To get an dialog box with input using javascript you can use window.prompt, look for more info here.
If you want something prettier go for a modal window. There are plenty plugins for jQuery (and there should be enough scripts available in vanilla JS as well) to achieve this.

Categories

Resources