window.open("index.php?option=com_comprofiler&view=emailuser&uid=" + userId + "&emailoptions=free");
Please Log in to join the conversation.
I'm sorry, but I'm not here to teach you how to write basic JS. That's just far outside the scope of our support where all we provide is basic examples. We do not provide custom coding assistance.
$('.cbEmailUserSubmit').click(function(){
var userId = $(this).closest( '.cbUserListRow' ).data( 'id' );
window.open("index.php?option=com_comprofiler&view=emailuser&uid=" + userId + "&emailoptions=free");
});
Please Log in to join the conversation.
Of course I've no intentions of offending anyone. Maybe we'll figure out something to have additional costs for more advanced support like coding assistance at some point.I always respect other's work and I demand the same. Maybe you are too busy to answer basic and "silly" questions like basic JS and in such cases I suggest you provide a link (as you did) in an effort to help those with little programming knowledge rather than typing what is quoted above as it could offend someone which I am sure in this case was not your intention, am I correct?
We don't get a lot of user on user participation here. We've discussed incentive programs like points system for discounted purchases to try and improve this, but nothing concrete yet. I suppose one of the issues being only subscribers can post here so that's going to be a limiting factor as well. Maybe at some point we'll allow non-subscribers to reply to active subscriber topics.Moreover, in many forums users participate a lot helping each other unlike this one. I respect how things work in Joomlapolis (the culture), it is just that in this case the way things are structured, help comes mainly from you.
I don't know where your HTML is to even know if the jQuery is correct. You'd need to check if userId is correct. You can log it to your browser console with console.log( userId ); and press F12 to open the console to see if it's correct. The below seams to work ok.P.S. Even with
<div class="cbClicksInside cbEmailUserSubmit">Click Me !</div>
$( '.cbEmailUserSubmit' ).on( 'click', function(){
const userId = $( this ).closest( '.cbUserListRow' ).data( 'id' );
alert( 'User Clicked: ' + userId );
});
$( '.cbEmailUserSubmit' ).on( 'click', function(){
const userId = $( this ).closest( '.cbUserListRow' ).data( 'id' );
window.open( 'index.php?option=com_comprofiler&view=emailuser&uid=' + userId + '&emailoptions=free' );
});
Please Log in to join the conversation.
<div class="row">
<div class="col-md-6 col-sm-6">
<div class="form-group"><select name="emailoptions" class="form-control"><option label="Please select" selected="selected" value="" class="noemail">Please select</option><optgroup label="Response 1" style="font-weight: bolder;"><option label="10" value="10" class="1"></option><option label="6" value="6" class="1"></option><option label="3" value="3" class="1"></option></optgroup><optgroup label="Response 2" style="font-weight: bolder;"><option label="24" value="24" class="1 2"></option><option label="12" value="12" class="1 2"></option><option label="6" value="6" class="1 2"></option><option label="2" value="2" class="1 2"></option></optgroup></select></div>
<div class="modules">
<div data-id="10">{loadmoduleid 240}</div>
<div data-id="button"><input name="submit" type="submit" value="Email [username]" id="submit-button" class="btn btn-primary cbEmailUserSubmit" /></div>
<div data-id="6">{loadmoduleid 234}</div>
<div data-id="3">{loadmoduleid 235}</div>
<div data-id="24">{loadmoduleid 236}</div>
<div data-id="12">{loadmoduleid 237}</div>
<div data-id="6">{loadmoduleid 238}</div>
<div data-id="2">{loadmoduleid 239}</div>
</div>
</div>
</div>
const selectElement = document.querySelectorAll('select');
selectElement.forEach(select => {
const modules = select.parentNode.nextElementSibling;
select.addEventListener('change', function () {
const indexSelected = this.selectedIndex;
const indexValue = this.value;
[].slice.call(modules.children).forEach((child, index) => {
child.style.display = child.dataset.id === indexValue ? 'block' : 'none';
if (indexSelected === 1 && (index === 0 || index === 1)) {
child.style.display = 'block';
}
});
});
});
$( '.cbEmailUserSubmit' ).on( 'click', function(){
const userId = $( this ).closest( '.cbUserListRow' ).data( 'id' );
alert( 'User Clicked: ' + userId );
});
Please Log in to join the conversation.
Where is this exactly? Is it inside a field on your userlist and showing per user? The jQuery provided is expecting the click to happen on an element in a users userlist row. Might be easier to just PM me a URL to the list if it's public access so I can review the structure exactly.HTML element form in UserList
Please Log in to join the conversation.
Where is this exactly? Is it inside a field on your userlist and showing per user? The jQuery provided is expecting the click to happen on an element in a users userlist row. Might be easier to just PM me a URL to the list if it's public access so I can review the structure exactly.
Please Log in to join the conversation.